ESP32 LOLIN SPI Problem

Any bugs you encounter with Flowcode should be discussed here.
User avatar
p.erasmus
Posts: 434
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

ESP32 LOLIN SPI Problem

Post by p.erasmus »

Hi Ben/leigh.

I have an issue with the SPI on the ESP32 Lolin Board.

If there is no Prescale selected then the SPI is clocking and MOSI /MISO Is working ,If I select the Prescale anything below 10MHZ then there is no SPI
so from 8MHZ up 80MHZ seems to work and even no value for Prescale :D
secondly the CS/SS Pins does not work automatically it just makes a funny shape on the signal it is trying to do something .
If I use the SPI CS Enable and disable macro's the I can drive the High and low .
I need 4MHZ Clock for my ADC device to work correctly :D
P1.jpg
P1.jpg (54.15 KiB) Viewed 8306 times
P_trace.jpg
P_trace.jpg (74.22 KiB) Viewed 8306 times
CS Pin Controlled by Automode Property

P3.jpg
P3.jpg (72.35 KiB) Viewed 8306 times
CS Pin Controled from a macro

CS-Pin.jpg
CS-Pin.jpg (68.92 KiB) Viewed 8306 times
Test.zip
(2.37 KiB) Downloaded 587 times
Regards Peter - QME Electronics

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 LOLIN SPI Problem

Post by p.erasmus »

Hi Team,

I really understand you are very busy however it would be nice if I can get some help here, if it is me doing something wrong or is there a problem with the SPI,The post is open for a few days and I would like to move on with this in the new week

Appreciate you help :D
Regards Peter - QME Electronics

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: ESP32 LOLIN SPI Problem

Post by LeighM »

Hi there
Sorry for delay.
(Doing a Google) it looks like the ESP32 SPI does not clock below 8MHz, which seems a bit strange.
If so, we are going to have to remove the options

Your auto CS is set on A5, but your pin drive is on A13
Is one a typo?

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 LOLIN SPI Problem

Post by p.erasmus »

Hi Leigh

That is just because I was playing with both pin 5 and 13 and some how the docs and code does not fit anymore and both work as IO's and when driven by myself with the CS commands/macros but when as CS pin with the auto CS function does not drive them for me Thanks for the info regarding the SPI clock may be we should remove the option

Thanks again then
Regards Peter - QME Electronics

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 LOLIN SPI Problem

Post by p.erasmus »

Hi Leigh

Can you please try this on your ESP32 board.
Auto CS does not work for me and also I noticed that 6MHZ clock working (Did not measure the time I will do to make sure it is really 6 and not 8 Mhz)

If I use Enable_CS and Disable_CS the CS pin as defined in the properties function, it is when I relay on Auto CS that there is no CS signal

May it it me I dont know :D
Test_2.rar
(980.79 KiB) Downloaded 702 times
Thanks
Regards Peter - QME Electronics

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: ESP32 LOLIN SPI Problem

Post by LeighM »

Despite the word "auto" I don't think that the SPI component does anything with the pin other than via the Enable_CS and Disable_CS

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 LOLIN SPI Problem

Post by p.erasmus »

Leigh.

Ok I can do that in code however then it does not make much sense having a Property that can be selected to yes/ NO and actually are there only for cosmetic reasons :D

What I did in a component with PIC18, I have used the Enable /Disable_CS macro's inside my component macro calls and then if you select Yes the CS pins is driven and when select NO there is no actions on the CS pin . It does have some sort of effect what what only you guys know maybe would be good if you guys can tell us how to use this Auto Property ? :D

Thanks for your help appreciated
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1952
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 510 times
Been thanked: 698 times

Re: ESP32 LOLIN SPI Problem

Post by BenR »

Hello,

The auto property I beleive gets rid of the CS pin property when set to no, forcing the user to control the CS pin themselves or not use a CS pin say if the pin not available or permanently tied to ground.

"Auto" is probably the wrong label, it should be more along the lines of "CS pin controlled by the component macros enable/disable".

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 LOLIN SPI Problem

Post by p.erasmus »

Hi Ben,

Sorry for my stupidity :oops: however I am still not getting what should happen when property is set to Yes ,
Should the SPI Component macro such as SPI Transaction automatically drive the CS pin or Not or is it the case
if CS is needed that regardless of the property setting the user should drive the CS pin in code

I am lost on this
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1952
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 510 times
Been thanked: 698 times

Re: ESP32 LOLIN SPI Problem

Post by BenR »

Hello,

You either need the Auto property set to yes and to call the enable / disable macros or you set to no if there is no CS pin.


I've just tried 400KHz on ESP32 SPI hardware and it's working just fine. What specific speeds are you trying and i'll test those here.

I've seen the 8MHz reference Leigh has spotted but the text is pretty vague about what the limits actually are.

Post Reply