Right now it seems when I send SPI data it send in chunks of 8 with a gap in between.
I need a continuous stream of data no breaks or gaps,
Also, can the ESP32 send data in formats longer than 8 bits?
RichardS
How to use the SPI and send continuous data no gaps...
-
- Posts: 59
- Joined: Mon Mar 26, 2018 7:57 pm
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to use the SPI and send continuous data no gaps...
That's interesting; normally you'd actually have to do something special to get behaviour like that. What do you do in your code, and how did you conclude there are gaps between the eight bits?
-
- Posts: 59
- Joined: Mon Mar 26, 2018 7:57 pm
Re: How to use the SPI and send continuous data no gaps...
Oscilloscope :=)
I did something like for testing:
uint8_t i = 0x55;
while(1) {
hspi->transfer(i);
}
there were gaps every 8 bits...
You are saying it should be fluent? If I sent say...
uint8_t array[100];
int i = 0;
while(++i != 100) {
hspi->transfer(array);
}
no gaps??
RichardS
I did something like for testing:
uint8_t i = 0x55;
while(1) {
hspi->transfer(i);
}
there were gaps every 8 bits...
You are saying it should be fluent? If I sent say...
uint8_t array[100];
int i = 0;
while(++i != 100) {
hspi->transfer(array);
}
no gaps??
RichardS
-
- Posts: 59
- Joined: Mon Mar 26, 2018 7:57 pm
Re: How to use the SPI and send continuous data no gaps...
BTW I have both I2S peripherals running with DMA at the time of this test.
And it is using the Arduino IDE also.
RichardS
And it is using the Arduino IDE also.
RichardS
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to use the SPI and send continuous data no gaps...
Ah, the Arduino SDK uses its own drivers, unfortunately I don't really know how those work. Also, moved this topic to the Arduino subforum.
Re: How to use the SPI and send continuous data no gaps...
You can send data in 8 or 16 bit chunks but also as a array.
https://www.arduino.cc/en/Reference/SPITransferSyntax
receivedVal = SPI.transfer(val)
receivedVal16 = SPI.transfer16(val16)
SPI.transfer(buffer, size)
-
- Posts: 59
- Joined: Mon Mar 26, 2018 7:57 pm
Re: How to use the SPI and send continuous data no gaps...
No problem, I have figured it out by writing my own driver for it within the Arduino IDE, I found someone with some fairly simple code to control the SPI... https://github.com/natanaeljr/esp32-SPIbus and I messaged it to work for me. And yes I get all the data I want out... and no gaps now! works very nicely....ESP_Sprite wrote:Ah, the Arduino SDK uses its own drivers, unfortunately I don't really know how those work. Also, moved this topic to the Arduino subforum.
Now I just wonder how to make it send a block of data out the SPI, and interrupt me when its done right now even though its DMA, it waits till all the data is sent....
RichardS.
-
- Posts: 1
- Joined: Sun Feb 06, 2022 2:25 am
Re: How to use the SPI and send continuous data no gaps...
Hello RichardS.,No problem, I have figured it out by writing my own driver for it within the Arduino IDE, I found someone with some fairly simple code to control the SPI... https://github.com/natanaeljr/esp32-SPIbus and I messaged it to work for me. And yes I get all the data I want out... and no gaps now! works very nicely....
Now I just wonder how to make it send a block of data out the SPI, and interrupt me when its done right now even though its DMA, it waits till all the data is sent....
Can you please post your code? I am trying to send rotary encoder data over esp now using interrupt and bit bang method but I'm getting guru meditation core panic after few milliseconds, so I think spi can do the job, thanks in advance.
Who is online
Users browsing this forum: No registered users and 91 guests