Close

Amazon Dash I2S bit banging

A project log for Amazon Dash and other STM32 ARM Adventures

Got STM32?

georgeGeorge 03/03/2016 at 20:340 Comments

I've spent the past couple of nights trying to piece together the code necessary to get the microphone running. I don't know much about clocks, PLLs, DMA, or even I2S for that matter, so there's been a lot of head scratching and hand waving about which code goes where.

The STM32F2 code base in the WICED SDK is missing a platform_i2s.c driver. I lifted the STM32F4's platform_i2s.c and deleted the stuff that confused me. I've written a stubby ADMP441 driver to setup the right GPIO before calling into my new platform_i2s.c where it will set up the I2S block and DMA channels.

I've been struggling to get DMA to generate an interrupt on completion of a block of microphone data, so I've turned off that code and focused instead on trying to get at the data by waiting for an SPI RX interrupt and effectively polling the bus for data. I've only gotten zeroes or a hung process, so I was suspecting that either the clock/PLL set up is wrong or the microphone just isn't enabled.

I don't own a logic analyzer (actually I ordered a cheapy off eBay today) so I can't verify data on the Dash's exposed CLK and WS pins are waveforms or just constant voltage. I guess once the logic analyzer arrives in the mail, I'll be able to use a hot air gun to remove the microphone and insert my probes in between to help debug the DMA problems.

Anyway, today I managed to get actual data from the I2S SPI port.

I don't know if that's actual PCM data or not, but it's definitely better than a bunch of nothing.

Discussions