week 6: embedded programming
6.1 intro ??
6.2 debugging week 4

Programming overview

debugging week 4

Back in week 4 I designed a board that mostly worked ... I could read signal from the device on my computer but couldn't get signal to the device (or couldn't get the device to return signal that it received from the computer?). basically, talking over serial was a one-way communication.

also, from week 2 still can't figure out how to program the circuits from my laptop. I have a 2018 macbook Air, so it only has USB-C ports. I've tried multiple different USB-C to USB adapters - making sure to account for the timer differences in USB 2.0 and USB 3.0, but in all cases my macbook doesn't recognize the programmer. I've been side stepping the issue by doing all the embedded programming on my CBA ubuntu desktop, but I'd like to be able to program in the lab and remotely on my laptop. furthermore. I know that it's not an issue with the USB 2.0 vs USB 3.0 adapter because I'm able to find the programmer with a USB 3.0 hub on the ubuntu machine.

time to start solving these problems . . .

starting with the macbook problem so maybe I can continue workingn on future programming issues from the comfort and warmth of my own home . . .
when I plug in the programmer (from week 2) to the USB 3.0 hub on my ubuntu machine and run lsusb the device appears as "Multiple Vendors USBtiny".
now I need the same thing to happen on my macbook.

first off, macOS doesn't have a simple lsusb command like ubuntu. To see all USB devices plugged in: apple > About this Mac > Systen report > Hardware > USB --everything should be listed. I also found this brew package that makes a lsusb command for mac - I installed and it appears to give the same info as the system report, but the package is about 5 years old and since I think the issue lies with the newest macbook changes (or else previous fabclass documentation would work) I won't rely too heavily on this replacement.

I ran lsusb three times - (1) nothing plugged in, (2) only mac multiport adapter, (3) ISP programmer plugged in to adapter - and it found the usbtiny!!

lsusb on mac finds usbtiny

and it shows up in the system report!!

USB system report finds usbtiny

I have no clue hwy it wasn't working before. The only thing I could think made a difference is the order that I plugged in the devices - perhaps the previous times I was always plugging in the adapter with the programmer already attached.

so when trying to program the board with Neil's make file, I get an error saying "Could not find USBtiny device"

could not find USBtiny device

But it's definitly there - so I think the issue is being introduced in the softawre I'm using to talk to avrdude: https://www.obdev.at/products/crosspack/index.html. yep - this seems to be a known issue with CrossPack and MacOS 10.14.

It's finding the device! but now getting at rc=-1 error from the circuit. I think this is because I've already programed the same circuit on the ubuntu machine earlier. moving on to test that I can communicate with the circuit only through the FTDI cable.

Neil's programming page calls to the USB device on "/dev/ttyUSB0", but this is linux specific. This strange and seemingly outdated blog post walks through how to communicate to tty on mac - to find all the TTY devices run ls /dev/tty*.
then use screen to talk to it: screen /path/to/device baud_rate and terminate screen with C-a C-\

Now I'm at least up to where I was on the ubuntu machine in week 4 on my macbook.