This afternoon was not as productive as I wanted it to be. To put it mildly, the sound player did not play ANY sounds when connected to the 8-pin microcontroller. Just in case the player was faulty, I swapped it with another microcontroller. That bigger microcontroller played both modules without any issue. But the smaller microcontroller does not even play either of the two modules. This means both sound modules are working perfectly.
ALL THE WRONG ON ALL LEVELS
One very strong possibility is that the chip cannot generate the different voltages for serial communication. The RS-232 communication standard needs these and the 5 volts is very limiting. The software could create the RS-232 function for the chip using software but it could not create the necessary voltages. In order to do this, I would have to either get the MAX232 IC or use more off the shelf components.
The bigger microcontroller does have the UART function (serial communication) and it communicated perfectly. Except when it instructs the sound player to reply back.
THE SOFTWARE USART SOLUTION
So, the most probable issue must be the smaller controller. According to its datasheet, it does not have any dedicated USART (Universal Synchronous/Asynchronous Receiver/Transmitter). This feature is allows the chip to communicate with the MP3 player. But no matter, I can use the Programming Software to create this serial communication function.
It is not working despite my trying everything. I have come across this problem before two years ago when trying out the RS-232 communications. There was data passing through and this proves voltage might not be the issue. But in this case, it is not true.
The red LED on the player goes on for half a second and then, that’s it.
THE PROBLEM WITH THE PROBLEM
Yeah, the title is a a precursor to what happened on the whole Sunday afternoon. The circuit did not do anything apart from the sound player flashing its red LED. I added a small instruction for the microcontroller to light up a white LED when it is transmitting serial commands, wait two seconds and then turn it off. This is a visual indicator to show how the program is behaving if it is running.
There is also another white LED at the Tx line which lights up when there is serial data.
The LEDs are a way for me to confirm where the program is or if it has reached a certain ‘checkpoint’. This is how I test or troubleshoot a program, bit by bit, until it is working. However, for this Sunday afternoon, nothing moved as what it should. The white LED lit up intermittently. At first, I suspect it was the prototype board because moving it around sort of made the LED light up.
There is a solution to this, which is called ICE which I can invest in. I can also use the software but in summary, putting the LED is a more cost effective for me.
After changing to a fresh board the problem was still there. And then I changed the SOIC-to-DIL adaptor because when I touched it and moved it slightly, the LED did light up. But there is no way both adaptors can be faulty.
THE CULPRIT?
Troubleshooting this simple circuit is very tiring and I have literally wasted one day. I have changed a lot of components and nothing is working. Then I noticed a weird response when I touched the serial communication resistors, the LED did turn on and off as it should. I started to poke about the board, thinking it was the warping which created loose connections.
It is like there is a stray capacitance and everything my finger goes near the microcontroller’s adaptor, the LED lit up. Not only does it not make any sense, the circuit has a solid ground back to the batteries. Out of frustration, I remove the sound player and suddenly, the whole circuit is working!
OK, that was a false alarm. After changing with the other sound module, the problem is still there. But what I noticed now is that again, when my fingers touched the SOIC adaptor, it is working but slightly at a faster speed. It is late at night and I will have to continue some other time.
The following is my backup plan, using another microcontroller which has a built-in UART but in an 8-pin package. I can use the bigger microcontroller but this would mean wasting unused 12 I/O pins though. But. let’s explore this option.
EVERY MANUFACTURER’S NIGHTMARE: THE POST-PANDEMIC CHIP SHORTAGE
I first had this issue in 2021 when I was doing the electronics for the Spirits Proton Pack. At that time, the Manufacturer could only provide me with the chips ONE YEAR after I placed the order. Thankfully, they resolved the issue. Here we are, in 2022 and the manufacture still have some issues with their inventory. The microcontrollers will be available in Septermber onwards. But I can have them by August if I can take at least a few thousand….
So, I had to find some alternative source for this chip.
After clicking to buy, I found out my matured Programmer could not program these chips.