User avatar
liudr
Posts: 687
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Reading SPI SRAM with python

Sun Sep 08, 2019 1:54 am

I have a project that needs pi to read bursts of data from arduino at a high rate and large quantity. Arduino doesn't have enough memory to hold all data so it needs a fast interface to send to pi. The fastest way I can think of is to have arduino fill an SPI SRAM module with data, inform pi via serial port. Pi reads data off SRAM and replies to arduino so it can fill it up again. The SRAM works at 20MHz to 40MHz. I figure that pi can read at 20MHz with the 40 pin header and SRAM on printed circuit board. Arduino can use serial port but the highest speed is 2Mbaud and arduino will freeze I fear some issues with multitasking and shallow hardware buffer on pi that will prevent pi from reading all data.

https://www.raspberrypi.org/forums/view ... hp?t=61955

What would you do if you need your arduino do this? Raspberry pi's USB ports are not available t hook up an FTDI serial USB chip, which I did test to run at 2Mbaud without missing data.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

User avatar
liudr
Posts: 687
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Reading SPI SRAM with python

Sun Sep 08, 2019 11:35 pm

It turns out that at 2Mbaud rate with hardware serial, rpi 0w loses a few bytes in the transmission. I used 1Mbaud at my target data transfer quantity and frequency and that worked.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

Return to “Python”