Close

Woohoo! (and D'oh!)

A project log for NFC Bose Wave Player

An NFC-enabled music player designed for kids to be able to pick their songs, built the hardest way possible

gilphilbertgilphilbert 07/22/2021 at 06:200 Comments

It's been an eventful week on this project. Where do I begin?

Buttons

Well, this one is a positive one (I guess...). I discovered a couple of slight bugs in the button firmware that had me pulling my hair out for two days. Fortunately my hair is fairly short, so the damage is minimal. It turned out that depressing a button wasn't being debounced at all - and worse, the button being sent was out by one (so you would see the last button pressed - always lagging by one button). After virtually rewriting the code I discovered I'd made a couple of small errors - one in my firmware and one in the ESP code. Long story short, that's all fixed - so the good news is that I believe the button firmware is now complete!

Hindsight Is A Beautiful Thing

While waiting for the power supply components to arrive in the mail, I fitted the ATtiny with the button firmware into the front panel. No suspense here - it didn't work. Then I tried the NFC reader - and that didn't work either. After some investigation, one will work at a time - but not both together. Obviously I assumed my code was to blame, but apparently that's not it. For some reason, the PN532 and the ESP32 aren't best friends. The PN532 will not share the I2C bus with any other device when connected to an ESP32 - this seems to be a known issue across multiple drivers. I haven't dug into it (since it seems a little pointless to do so), but that's how it is. So, this means my new set of PCBs coming in the mail are already doomed - they're based on a shared I2C bus which is now dead in the water.

Of course, if I had prototyped the whole thing together, this wouldn't have happened. Regardless, the PN532 does play nice on the SPI bus. Well, it didn't, but I made some changes to the driver to maintain SPI settings on a shared bus and now it works fine with the SD card and display on the same SPI bus. Now I will need to make a few changes as some SPI pins are missing on the connector between the main board and the front board - so both boards will need to be changed to swap from I2C to SPI.

Sound from the DAC, at last!

Let's silver-lining this thing then. Once the new boards arrived, even knowing they wouldn't be final, I soldered up the new boards. I was going to check every section of this before I order any more PCBs. I started with the DAC section, since I was waiting for the power supply components to arrive in the mail. This has caused me headaches previously so I thought I'd give it a go again - it would be much nicer to use my own PCM5102A design instead of an off-the-shelf component. After wiring everything to my previous prototype and powering it on... I got sound first time! This is great news.

We Have Power

That's right, the final set of components arrived in the mail today and I assembled my faulty board. Well, mostly, anyway. The power section, ESP32 and PCM5102A are all assembled. I fired it up, measured all the voltages and it looks great. This was true last time, yet the thing failed miserably, so I connected to the ESP32 and loaded some firmware to simply play all the songs from the SD card through the DAC. I powered it up, popped on my headphones and... silence. Oh, no - not again. Then I realized that the XSMT (soft mute) of the PCM5102A needs to be pulled high... just maybe. A quick firmware change and... nothing. But why isn't it working? I grabbed my multimeter. Amazingly, the pin on the ESP32 wasn't soldered - it was missing on this one pin! I soldered it quickly, plugged the cable into the wall... and nothing. Oh, come on! Then I realized: in my haste, I hadn't reconnected the other end of the power cable to the PCB. I plugged it in and... glorious sound! No static, nothing!

Looks like I can order my final set of boards. Again...

Discussions