SPI Slave - Missing data during the first few seconds after initialization

mpulis
Posts: 57
Joined: Mon Aug 07, 2017 7:53 am

SPI Slave - Missing data during the first few seconds after initialization

Postby mpulis » Mon Dec 02, 2019 11:06 am

Hi all!

I've setup a program which reads incoming data over the SPI Slave Interface and saves all the received data to a file on a connected SD card once the buffer which is being written to is full. The received data is in the form of an incrementing counter.

The problem which I'm observing is that some data being transmitted over SPI from the host is being lost during the first 34 seconds of the program running. After those 34 seconds have elapsed, I can find no missing data in the data saved in the SD card.

I can't make sense of why this is happening. The SPI Slave task is the only task running on core 0, while the task responsible for handling the SD card is running on core 1.

Are there any background functions which are running on core 0 in those 34 seconds after the ESP32 is initialized?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: SPI Slave - Missing data during the first few seconds after initialization

Postby PeterR » Mon Dec 02, 2019 7:13 pm

Are there any background functions which are running on core 0 in those 34 seconds after the ESP32 is initialized?
Timer tasks, lwip tasks, IDLE etc.
But I suspect that the problem is closer to home. Maybe power to SD, your buffering, one of your tasks blocking?

I have done a fair amount of SD logging & no start up issues (so far)!
& I also believe that IDF CAN should be fixed.

mpulis
Posts: 57
Joined: Mon Aug 07, 2017 7:53 am

Re: SPI Slave - Missing data during the first few seconds after initialization

Postby mpulis » Tue Dec 03, 2019 8:56 am

If the problem was coming from those tasks, wouldn't the problem persist beyond those 34 seconds? I've run tests for an hour with the same results. It does seem to be something to do with initialization.

Could it be that there is some conflict initially between the SDMMC host and the VSPI peripheral I'm using for the SPI Slave?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: SPI Slave - Missing data during the first few seconds after initialization

Postby PeterR » Wed Dec 04, 2019 12:20 am

Hi,
Please show the libraries etc that you are using. Maybe some source?

I have used SPI SD (not SDMMC). I produced a SPI SD qualifcation test & that ran for ages whilst shaked n baked.
I had to write my own SD driver based on ANO library. I did look for out of box but found a lot of buggy Ardunio code. Maybe thats your issue?

I am not saying that the problem is in 'those' tasks. Rather that 'those' tasks are running.
All I can suggest is that you produce a simple worked example and post.
The WROOVER has SD and SPI (?). Maybe an example based on would allow others to repeat?
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 119 guests