SPI slave mode (example)

AAAwen
Posts: 15
Joined: Fri Sep 08, 2017 6:00 am

Re: SPI slave mode (example)

Postby AAAwen » Fri Dec 01, 2017 9:15 am

Dear all,

The new ESP-IDF which updated last week work this sample very well. :P

But, how much frequancy does the spi-slave reach? thanks.

大家好,

我的英文很差,请见谅。

官网上最新的sdk解决了这个问题。

我现在有个新问题请教各位大神,spi从端能达到的最高速度是多少?主端好像到几十M但是从端似乎跟不上

谢谢

ESP_Sprite
Posts: 2761
Joined: Thu Nov 26, 2015 4:08 am

Re: SPI slave mode (example)

Postby ESP_Sprite » Sat Dec 02, 2017 9:47 am

If you use random pins, the speed can go up to 20MHz (absolute max) if the signals are well-formed (50% duty cycle, clean edges etc) although a max of 10MHz may be better to keep in mind if you're not sure about the well-formed-ness. If you use the dedicated pins for the SPI peripheral you select, you can get up to 40MHz (again, absolute max) with well-formed signals and 20MHz for random signals.

AAAwen
Posts: 15
Joined: Fri Sep 08, 2017 6:00 am

Re: SPI slave mode (example)

Postby AAAwen » Mon Dec 04, 2017 2:03 am

Hi! ESP_Sprite,

Thanks for your reply.

I used the spi-slave sample upon two esp32-kit.
When I raise the sender's speed(ex. .clock_speed_hz=10000000), I receive messy message.
When I reduce the speed to 8MHz(.clock_speed_hz=8000000), it work well.
What's wrong with the spi-slave? Thank you!

我有两个esp32的开发板用于sdk里spi-slave的测试,
当我把发送端速度调到10M( .clock_speed_hz=10000000),收到的都是乱码;
当我把发送端速度调到8M(.clock_speed_hz=8000000),接受正常
spi的从端是否真能达到以上所说的20MHz(甚至是40MHz)?

ESP_Sprite
Posts: 2761
Joined: Thu Nov 26, 2015 4:08 am

Re: SPI slave mode (example)

Postby ESP_Sprite » Mon Dec 04, 2017 8:19 am

Hard to say from wording like 'very messy'. Can you be more specific; what exactly do you send, what exactly do you receive? Do you have an oscilloscope trace of the signals on the line?

AAAwen
Posts: 15
Joined: Fri Sep 08, 2017 6:00 am

Re: SPI slave mode (example)

Postby AAAwen » Thu Dec 14, 2017 5:32 am

Hello!ESP_Sprite,

When I set .clock_speed_hz=8000000, the spi work well.
esp32-spi-8M.png
spi-slave 8M
esp32-spi-8M.png (121.58 KiB) Viewed 2096 times
But, when I set .clock_speed_hz=10000000, I receive wrong data as follow.
esp32-spi-10M.png
spi-slave 10M
esp32-spi-10M.png (143.91 KiB) Viewed 2096 times
Thanks!

ESP_Sprite
Posts: 2761
Joined: Thu Nov 26, 2015 4:08 am

Re: SPI slave mode (example)

Postby ESP_Sprite » Thu Dec 14, 2017 9:04 am

Any chance you can connect an oscilloscope to your signal lines? I'm thinking that stray capacitance or something may mess up your clock signal.

venkateshmunna
Posts: 1
Joined: Fri Dec 22, 2017 3:25 am

Re: SPI slave mode (example)

Postby venkateshmunna » Fri Dec 22, 2017 3:27 am

LakshmiDhanaraj wrote:Hi,

I am using the SPI slaver driver example,sender as master and receiver as slave.I can able to transmit/receive data without dma.But it restricts the number of bytes to 32.For transmitting more than 32bytes,I am enabling the dma to 1,won't receive/transmits the data.Please help me out to solve this issue.What I have to change in the code for transmitting more than 32 bytes?


Can you please send the code, I am struggling with code.

Who is online

Users browsing this forum: Majestic-12 [Bot], WiFive and 21 guests