pyboard - SPI capture issue

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
roiz
Posts: 4
Joined: Sun Apr 03, 2022 4:30 pm

pyboard - SPI capture issue

Post by roiz » Wed Jun 01, 2022 9:38 am

Hi All,
I'm using pyboard connected to SPI lines. Those lines have messages that each message is 128Bytes.
when I'm using spi.recv(128) I'm getting a mess of messages ( some from the middle of a message some from the end of the message).

The SPI CLK is: 10Mhz

SPI space between messages is: 0.2mS

other properties:
pyb.freq() --> (168000000, 168000000, 42000000, 84000000)
SPI(2, mode=2, baudrate=25000000, polarity=0,phase=1,bits=8,firstbit=SPI.LSB)

Does someone have an idea how to capture the message as a complete message (when CS enables) and save it?

Thanks

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: pyboard - SPI capture issue

Post by pythoncoder » Wed Jun 01, 2022 12:44 pm

I take it you're using peripheral (slave) mode, although mode=2 is not a value I'm familiar with. The Pyboard D I have here reports 0 and 260 for the two available values.

The problem is likely to be that your processing of the data takes longer than 200μs, causing the next read to be miss-framed. Bear in mind that .read() is a blocking call.

[EDIT]
I deleted your other post which is effectively a duplicate of this one.
Peter Hinch
Index to my micropython libraries.

roiz
Posts: 4
Joined: Sun Apr 03, 2022 4:30 pm

Re: pyboard - SPI capture issue

Post by roiz » Wed Jun 01, 2022 1:11 pm

Thank you Peter for your help.

As you can see from the attached snapshot from Saleae that the frame(width of the message) is 98.4uS

Do you think that the pyboard can handle this kind of stream?

Do you think that other python modules can handle this kind of load?
Attachments
Screenshot 2022-06-01 210131.png
Screenshot 2022-06-01 210131.png (6.88 KiB) Viewed 21707 times

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: pyboard - SPI capture issue

Post by pythoncoder » Mon Jun 06, 2022 7:45 am

It's as I said above. You're getting 128*8=1024 bits at 10MHz so your frame period is indeed 98μs. It's the 200μs gap between these frames which may be the limiting factor, depending on what you do with those 128 bytes after you've received them.
Peter Hinch
Index to my micropython libraries.

Post Reply