Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
board reboots with 24bit SPI
#1
Hi. On Sipeed Maix Go, I tried to configure SPI with 24bit like so:


Code:
spi = machine.SPI(mosi=28, miso=26, sck=27, cs=29, baudrate=8000000, firstbit=machine.SPI.MSB, bits=24)


then when I try to use it, the REPL hangs, then reboots itself.
Reply
#2
To which device are you trying to connect?
Could you post part of the code after the SPI instance creation ...
Reply
#3
Hi Boris.

I'm connecting to an SSD2828 RGB to MIPI bridge chip. It's very much like connecting to a display.
It has various (3) different SPI modes, but the board I have here has been hard-wired for the 9-bit SPI mode. This means it expects 9 clocks per 8 bits of data, with an initial data/command bit.

It looks like anything over 8 bits for the spi constructor causes the K210 micropython to hang. It is an issue in the original MaixPy as well, except their version just hangs forever, but yours restarts itself (a watchdog ?)

e.g.
https://github.com/sipeed/MaixPy/issues/51

As far as code goes, I simply try to do something like spi.write(bytes([0xf0])) or something (sorry, working from memory.. don't have anything here right now.)
Reply
#4
Unfortunatelly, K210 Technical Reference Manual is not available and inner working of the SPI peripheral is not documented anywhere.
After some investigation, it looks like the K210 SPI peripheral is not capable of generating clock cycles which are not multiple of 8!

So, the bits argument can actually be only 8, 16 or 32 and actually only means that the data in the input buffer are treated as 8-bit, 16-bit or 32-bit values.
For example, the bytearray b'\x01\x02\x03\x04\x05\x06\x07\x08' wil be transfered as:
01 02 03 04 05 06 07 08 in 8-bit mode
02 01 04 03 06 05 08 07 in 16-bit mode
04 03 02 01 08 07 06 05 in 32-bit mode


I'll try to investigat it further, if nothing can be done, I'll try to add the software SPI to the module supporting SPI transfers of data with any bit length.
I think it should work well with baudrates up to 20 MHz. 

Yes, the watchdog resets the system (default timeout is 6 seconds).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)