SPI driver corrupted GPIO39, GPIO36, GPIO34, GPIO35

progman.rus
Posts: 3
Joined: Mon Dec 02, 2019 9:37 am

SPI driver corrupted GPIO39, GPIO36, GPIO34, GPIO35

Postby progman.rus » Mon Dec 02, 2019 9:58 am

I catch one problem when I use two cores.
Every time I read the state of GPIO39, GPIO36, GPIO34, GPIO35 on the first Core of ESP32 and I draw a picture to LCD via SPI on the second core of ESP32 the value of GPIO39, GPIO36, GPIO34, GPIO35 is corrupted.
( this time nobody sends a signal to this GPIO !!! )

There is a very easy code when the bug happens.
This code starts on Core 0

Code: Select all

for( ;; )
{
    uint32_t addr = SPI_CMD_REG( VSPI  );//addr == 0x3ff65000 
    uint32_t v    = ( ( uint32_t* )addr )[ 0 ] | ( 1 << 18 );
    v             = (( uint32_t* )addr )[ 0 ];
    delay( 1 );
}
There is a code of Thread2. This code starts on Core 1

Code: Select all

for( ;; )
{
   uint32_t gpioin1val = GPIO.in1.val;
   for(;;)
   {
     if( gpioin1val != GPIO.in1.val )
         bugreport( ); // <- there is a bug. 
         
     delay( 1);
   };
}
The "bugreport" should never call. But it calls. Somewhere inside the driver corrupted data of GPIO.in1.val value.
Only GPIO.in1.val is corrupted. The GPIO.in is OK.

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: SPI driver corrupted GPIO39, GPIO36, GPIO34, GPIO35

Postby idahowalker » Mon Dec 02, 2019 8:29 pm

https://docs.espressif.com/projects/esp ... /gpio.html
GPIO34-39 can only be set as input mode and do not have software pullup or pulldown functions.

progman.rus
Posts: 3
Joined: Mon Dec 02, 2019 9:37 am

Re: SPI driver corrupted GPIO39, GPIO36, GPIO34, GPIO35

Postby progman.rus » Tue Dec 03, 2019 2:11 am

I do not write to GPIO39, GPIO36, GPIO34, GPIO35!!!
I only read. Look the code.

Who is online

Users browsing this forum: No registered users and 74 guests