hideakitai / ESP32SPISlave

SPI Slave library for ESP32
MIT License
50 stars 15 forks source link

time interval between each transaction #43

Closed alireza7313 closed 2 months ago

alireza7313 commented 3 months ago

Hello! I am currently working on reading raw ADC data from the ATM90E36 digital signal processor using an ESP32 microcontroller. The ATM90E36 has 7 channels of 16-bit ADC with a sampling frequency of 8 kHz. Data is read via SPI using the following metods: 1) queue_multiple_transactions_and_wait_for_all_results, and 2) transfer_one_by_one. According to the ATM90E36 datasheet (page 30), the sample interval should be 125 microseconds. However, in practice (as shown in the image below), when measuring the timestamps in microseconds during the reception of each sample, it can be said that the interval between samples is 1000 microseconds, which is 8 times the value specified in the ATM90E36 datasheet (i.e., 125 microseconds). table_master also I attach code file below. atm90e36_master_t.zip

How can the sample acquisition time be reduced? Generally, do the slave.queue(), slave.wait(), and slave.transfer() commands have the capability to transfer data at a speed of 125 microseconds (equivalent to an 8 kHz rate)? Thank you!

hideakitai commented 3 months ago

I'm sorry, but I don't have enough time to read the datasheet of ATM90E36. Am I right in understanding that the slave receives data from the ATM90E36 at longer intervals than expected? slave.transfer() is the shortest duration to queue, wait, and receive from the master device in the current architecture of this library. If it doesn't fit you, I recommend making your own slave program using esp-idf APIs. https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/spi_slave.html