Embedded Programming

Week 7

This week our group assignment is to compare the performance and development workflows for other architectures(The group assignment is here). Individually we have to read a microcontroller data sheet program your board to do something, with as many different programming languages and programming environments as possible

Tools: PCB Mill (Clank), Soldering Iron, KiCad
Date: 10.22.2020


Here is my schematic for reference. I have an LED and room for a tactile button and a capacitive sensor.

To get the Arduino IDE to work with the ATTiny412 I had to go to Arduino -> Preferences -> (Additional Board Manager URLs) text box and enter http://drazzy.com/package_drazzy.com_index.json into the field as a separate line and click the OK button

Next, was the Arduino board manager. Tools -> Boards -> Boards manager. In the board manager, enter megaTinyCore into the search bar and scroll, you will see (megaTinyCore by Spence Konde) and click on install.

First run
> pip3 install intelhex pylint pyserial

Clone the UPDI Repository into your computer and navigate to pyupdi -> updi

Then run
> python3 pyupdi.py -d yourprocessor -c your_port -b your_baud_rate -f your_hex -v

I specifically did
> python3 pyupdi.py -d tiny412 -c /dev/tty.usbserial-AR0K4XLQ -b 57600 -f ~/Documents/Arduino/build/HTMAtest.ino.hex -v

You can run the following to look at all your ports
> ls /dev

I had a short on my board and that was a major issue. The ports on my Mac stopped working and my FTDI to Serial board got super hot and I'm lucky it didn't break. Anyways I fixed the short

The code finally worked and uploaded using pyupdi, but my led wasn't flashing. Turns out I was addressing the ports incorrectly. I thought port 3 was pin 3, but turns out port 3 is pin 4. See the picture below and the link for that info is here.



Once I figured out the pin situation and hooked up 5v to my board it worked like a charm!



I got it flashing! I then played around with the values a bit and decided to add in the capacitive sensor. It's only sensitive to within 2 inches, but not bad for a prototype. I think we can make this work! Also I ran into a memory issue. The problem here I think is the library has a lot of overhead. The workaround I used was to delete a couple extraneous commands. Ideally however I either switch to a larger microcontroller or I write my own code for the capacitive sensing.