Thanks for the reply.
I'm not quite sure I follow... can you elaborate?
It just seemed to me that the buck was being passed over to you.
It's almost certainly possible to use machine.mem32 to set the PIO shiftctrl register directly from Python
It appears that is the answer. I got an answer on the RP forum from someone suggesting the same thing and eventually I made it work without errors.
Code: Select all
from machine import mem32
PIO_base = [ 0x50200000, 0x50300000 ]
SM_SHIFTCTRL= [ 0x0d0, 0x0e8, 0x100, 0x118]
PIO_FIFO_JOIN_TX = 1
PIO_SM0_SHIFTCTRL_FJOIN_TX_BITS = 0x40000000
PIO_SM0_SHIFTCTRL_FJOIN_RX_BITS = 0x80000000
PIO_SM0_SHIFTCTRL_FJOIN_TX_LSB = 30
# then after I defined my UART in the variable 'port' I added
#join TX and RX FIFOs gogether to make 8 deep
reg = mem32[PIO_base + 0] # state machine number
reg = (reg & ~(PIO_SM0_SHIFTCTRL_FJOIN_TX_BITS | PIO_SM0_SHIFTCTRL_FJOIN_RX_BITS)) | (PIO_FIFO_JOIN_TX << PIO_SM0_SHIFTCTRL_FJOIN_TX_LSB)
mem32[PIO_base + 0] = reg
Now this worked and didn't stop the code running, but then it didn't overflow before, maybe due to the baudrate being so high and microPython being so slow ( relatively speaking ) that I was not throwing values at them fast enough to overwhelm a buffer of four.
So I need to slow the baud rate down and to check that buffer didn't overflow using the buffer status register which I haven't done yet. I will update the post when I have.
Thanks again I appreciate your input.