12/24/2021 at 09:33 •
I was putting together a few more 8042 boards since the original order netted me 5 PCBs and they were panelised 2 per PCB. One didn't work with the same EPROM as the others. Today I compared it with a working board and noticed that the crystal capacitors were supposed to be like the 3D rendering above, but I had soldered them in rotated 90°. In fact the silkscreen has lines indicating the orientation, and the labels are also a hint. That was dumb of me. A few minutes later it was fixed and worked straight off.
Solved a puzzle, a nice holiday season present for myself! Happy holidays everyone and stay safe!
12/07/2021 at 12:22 •
I bought a relay module and the matching ESP8266-01 WiFi module for a couple of bucks (bargain!), in order to experiment with remote control. In particular I'm thinking of fitting one into an amplifier for remote turn-on. The module is quite small, that photo is larger than life size. It's about the size of a matchbox and perhaps twice as high. The ESP8266-01 fits onto the 8 pin yellow socket in the picture. These are my notes on getting it to work. I will augment this page as I encounter and solve issues.
A search for ESP8266-01 will get you quite a few instruction pages. Usually they suggest you start by connecting a serial terminal on an Arduino to it. You could also use a FDTI adaptor. I came across these issues:
Diagrams show that you have to take the EN pin high (3.3V) to allow it to work. But the RST pin must also be taken high or the module may not respond. Later on you should make provision to ground GPIO-0 to flash programs if that's what you want to do.
Beware of "smart left and right quotes" on web pages if you copy and paste commands, in particular the command to register with an AP, giving the SSID and password. You must use the ASCII double quote.
In one Fritzing diagram, hosted by the Arduino site no less, a 5V to 3.3V regulator is shown on the breadboard you'll need to expand some connections like 3V3 and GND. I'm not sure why; the Arduino board, at least the Uno, already has a 5V to 3.3V regulator.
I came across one article discussing ways to expand GPIO. One way is to use an I2C extender. Besides GPIO-0 and 1, Rx and Tx could be used for a total of 4. But such measures are probably unnecessary nowadays; buy a later ESP8266 or ESP32 module with far more I/O pins for not much more money.
Last edited 2021-12-08
10/13/2021 at 10:02 •
I previously showed how to set up PlatformIO. Now I demonstrate putting PlatformIO to debugging firmware for the STM8. Debugging is where the IDE comes on its own as you can see multiple pieces of information on the screen, unlike a text debug session.
Assuming you have all the build and debug tools installed for STM8 in PlatformIO, and you have the board connected to your host computer with a STlink dongle, then when you open the file explorer to the code you want to debug, and click on icon D, you should get a display like this. As you can see the relevant controls aren't exactly grouped well, they are scattered all over the screen, but you will get used to that. The left column shows the state of the program, including any breakpoints.
To set a breakpoint, right click on the space before the line number and it will allow you set or delete breakpoints. As you can see there's one on line 25.
Start the program with the arrow at R. It will first stop at the beginning of main(), then you can continue using the continue arrow control at C. Here you see we have paused at line 25. You can step into lines or over lines using the controls. These correspond to the gdb commands S and N and can be entered as text at the prompt under the debug console T. However if the program has gone into a loop without hitting any breakpoints, you will have to use the interrupt button at C. This cannot be done from the prompt. You can also restart the session.
Other gdb commands like print [variable] also work, but it's more convenient to watch the variable display in the left column.
One drawback to using debugging from the IDE is that the generated firmware will be larger and may not fit in flash memory if you are near the limits.