Code: Select all
>>> import sys
>>> sys.path
['', '/flash', '/flash/lib']
Code: Select all
>>> import sys
>>> sys.path
['', '/flash', '/flash/lib']
Code: Select all
os.mount(pyb.MMCard(), '/mmc')
sys.path.append('/mmc')
pyb.usb_mode('VCP+MSC', msc=(pyb.MMCard(),))
pyb.MMCard().power(1)
RichOutoftheBOTS_ wrote: ↑Tue Feb 12, 2019 4:36 amok then a little more complex than just using current SPI function and altering them to be I2S
For a continuous flow of data like I2S needs then double buffering DMA can be used where it uses 2 different RAM buffers and when it is finished transferring 1 buffer it flags an interrupt then moves to the second buffer then when it is finished then it flags an interupt again before moving back to the first buffer in a circular buffer mode. When the interrupt fires from the DMA finishing a buffer anf moveing to the other buffer that interrupt can be used to up date the buffer.
It would have to be implemented in C as python callback have too high latency for this sort of stuff. So definitely not a super quick bit of code to develop.
From the reference manualDouble buffer modeThis mode is available for all the DMA1 and DMA2 streams.The Double buffer mode is enabled by setting the DBM bit in the DMA_SxCR register.A double-buffer stream works as a regular (single buffer) stream with the difference that it has two memory pointers. When the Double buffer mode is enabled, the Circular mode is automatically enabled (CIRC bit in DMA_SxCR is don’t care) and at each end of transaction, the memory pointers are swapped.In this mode, the DMA controller swaps from one memory target to another at each end of transaction. This allows the software to process one memory area while the second memory area is being filled/used by the DMA transfer. The double-buffer stream can work in both directions (the memory can be either the source or the destination) as described in
RWLTOK wrote: ↑Sat Feb 22, 2020 5:38 amBryan we have never met. I am trying to implement something like this except SPI and not I2S. Any progress?
SPI can do exactly the same thing it is just a case of someone writing the code then wrapping ti up for MP to be able to call it.OutoftheBOTS_ wrote: ↑Tue Feb 12, 2019 4:36 amok then a little more complex than just using current SPI function and altering them to be I2S
For a continuous flow of data like I2S needs then double buffering DMA can be used where it uses 2 different RAM buffers and when it is finished transferring 1 buffer it flags an interrupt then moves to the second buffer then when it is finished then it flags an interupt again before moving back to the first buffer in a circular buffer mode. When the interrupt fires from the DMA finishing a buffer anf moveing to the other buffer that interrupt can be used to up date the buffer.
It would have to be implemented in C as python callback have too high latency for this sort of stuff. So definitely not a super quick bit of code to develop.
From the reference manualDouble buffer modeThis mode is available for all the DMA1 and DMA2 streams.The Double buffer mode is enabled by setting the DBM bit in the DMA_SxCR register.A double-buffer stream works as a regular (single buffer) stream with the difference that it has two memory pointers. When the Double buffer mode is enabled, the Circular mode is automatically enabled (CIRC bit in DMA_SxCR is don’t care) and at each end of transaction, the memory pointers are swapped.In this mode, the DMA controller swaps from one memory target to another at each end of transaction. This allows the software to process one memory area while the second memory area is being filled/used by the DMA transfer. The double-buffer stream can work in both directions (the memory can be either the source or the destination) as described in
I have used double buffering for a little SPI screen once before but have long lost that code.
Rich
OutoftheBOTS_ wrote: ↑Sun Feb 23, 2020 1:20 amRWLTOK wrote: ↑Sat Feb 22, 2020 5:38 amBryan we have never met. I am trying to implement something like this except SPI and not I2S. Any progress?
SPI can do exactly the same thing it is just a case of someone writing the code then wrapping ti up for MP to be able to call it.OutoftheBOTS_ wrote: ↑Tue Feb 12, 2019 4:36 amok then a little more complex than just using current SPI function and altering them to be I2S
For a continuous flow of data like I2S needs then double buffering DMA can be used where it uses 2 different RAM buffers and when it is finished transferring 1 buffer it flags an interrupt then moves to the second buffer then when it is finished then it flags an interupt again before moving back to the first buffer in a circular buffer mode. When the interrupt fires from the DMA finishing a buffer anf moveing to the other buffer that interrupt can be used to up date the buffer.
It would have to be implemented in C as python callback have too high latency for this sort of stuff. So definitely not a super quick bit of code to develop.
From the reference manual
I have used double buffering for a little SPI screen once before but have long lost that code.
Rich