Hello again from the land of audio ones and zeros.
I am continuing to move away from using the Arduino IDE for any microcontroller programming needed.
This time I continue to move towards a more C-language approach to electronic design. I mostly am doing this to learn how MPUs and peripherals really work "at a deep level"; Arduino's IDE sometimes shields you from that.
The move to C won't necessarily save time or make projects easier to finish however. The AudioDiWHY mantra: why make things easy?
I began this learning process a long time ago--post here.
Leaving the Arduino IDE we quickly see something new (for me anyway): C programming is hard! Pointers? References? Registers? Mallocs? Dereferencing? Ampersands? .h files. At first, you have to love it. No one else will.
I have decided to try to write my own library for I2C....I can use one that's already done (e.g. here) but it is more educational to write my own or at least modify an existing one to the point I can understand how it--and I2C--works. Update: 2-24-21 libraries are done, or at least work for the basics. See the post here.
|Clockwise: Bona-Fide Uno, Atmel Ice Programmer, Sacrificial Uno Clono|
Much swearing ensued, and then I realized--why am I cursing? It turns out I had a few extra 328P's, and the clone used a through hole MPU (so, I got lucky). So I removed and discarded the blown out chip. I put in a new one. Fixed!
Can I save the broken MPU? Probably, information about that (for ATTINY anyway) is here. Is it worth the time? The blown up MPU is a USD$2.50 part. Nope.
(Which begs the question: why the tantrums? It must be other things in my life right (like Covid?) Can I blame it on my parents? Why not. Growing up my dad worked on cars all the time and was constantly swearing at them, kicking them, getting in a terrible mood because of them. And he loves cars! WTF? Whatever. It was how he rolled, but for me, it serves no purpose; it's not cathartic and it makes me a way worse tech.)
OK on to the next problem. After working perfectly for a few days, the Clone Uno's UART stopped working. Why? well it could be a lot of things, perhaps related to aforementioned fuse issues, but maybe not.
I want to fix this logically.
For starters, maybe it's not the MPU/MCU at all. Is it the terminal program (TeraTerm: good program, free, here) I am using?
Hooking up a few known good UART devices into the PC running TeraTerm--yields, at best, mixed results. Sometime I saw data in the terminal output, sometimes not. The program should run without issue 100% of the time. So yes, that might be it.
I booted my old Linux system, here, I know Putty works on the laptop...but the old laptop won't boot. Overall not my day. I'll fix that later.
Back to the W10 system. Welcome to Microsoft Windows hell, where everything that could be easy isn't....these guys are too smart for their own good and light cigars with $500 bills. Sometimes I'd get cryptic messages like "you don't have rights to use COM port 20", even when running TeraTerm with full rights. This one got me stuck for a bit. COM20? Why isn't Tera Term using COM3?
In windows you use Device Manager to change your COM port configuration but that appeared to be no help until I found the webpage here. You have to show "hidden devices" to delete or modify the "invisible COM ports".
So: run device manager (start > run > devmgmt.msc) and then "View > hidden devices". Yes, I had 18--count 'em--18 hidden com ports. Right click > Deleted them.
Wow, that felt good.
Plugged back in the UNO. COM3! Yes!!!!! Now find the COM port in device manager: right click > Port Settings tab > Advanced. I can change the COM port number now.
To make sure it all worked, I set the Uno's USB serial port from COM3 to COM4. Yes, that works too, so this is fixed.
|You need device manager's "advanced properties" to show you your stale COM ports.|
BODLEVEL = 2V7
RSTDISBL = [ ]
DWEN = [ ]
SPIEN = [X]
WDTON = [ ]
EESAVE = [ ]
BOOTSZ = 256W_3F00
BOOTRST = [X] <--HAD TO CHANGE THIS; use Optiboot bootloader
CKDIV8 = [ ] <--HAD TO CHANGE THIS; Uno expects /8 clock
CKOUT = [ ]
SUT_CKSEL = EXTXOSC_8MHZ_XX_16KCK_14CK_65MS <--HAD TO CHANGE THIS; use external Crystal on Uno board
EXTENDED = 0xFD (valid)
HIGH = 0xDE (valid)
LOW = 0xFF (valid)
|Nice to see text on the right! I was lost, now I'm found.|
|DeBugWire works with the indicated trace cut, but Arduino IDE won't.|
|"You need Schoolin"|