blmorris / micropython

The Micro Python project
MIT License
2 stars 1 forks source link

I2S on PybV3 #3

Closed rkrishnan2012 closed 4 years ago

rkrishnan2012 commented 7 years ago

Hey @blmorris ,

I'm trying to run your I2S branch on the PyBoard v3 and your audio codec board (I fabbed my own pcb). I don't believe hardware is an issue, but when I try to run your I2S Code, it seems to be hard faulting after running HAL_I2SEx_TransmitReceive_DMA for the second time on the i2s_stream_handler. I got around the I2S state not being ready when the callback is fired by running only the transmit command (not the duplex TransmitReceive) but still getting a hard fault.

Have you run into this before (hard fault when doing the DMA transfer for the second time)?

Edit: For context, I'm trying to merge your I2S code into the latest HAL api changes introduced.

Thanks! Rohit

blmorris commented 7 years ago

Hi Rohit- Sorry for letting this go unanswered, I as haven't been working on this project or paying attention to it recently. To give a quick answer before I try to dig any deeper, it has been close to two years since I had my I2S branch up to date with micropython, and I haven't been tracking the uPy project that closely since changing jobs about a year ago. The I2S branch worked in that it could play and record audio to a codec, but it definitely wasn't ready to merge in that it spent way too much time in the interrupt service routine reading and/or writing the filesystem on the SD Card. If you tried to do pretty much anything else while the I2S module was running, you could miss an interrupt and either the audio stream would break or the system would crash. The way to solve this would be to use a Soft IRQ to handle the filesystem IO, but this wasn't in place while I was working on the project. I will need a little time to get back up to speed with my code here, but if you are interested I would love to see this project through to completion. So please bear with me and I will try to update in a few days.