Page 1 of 1

SPI driver corrupted GPIO39, GPIO36, GPIO34, GPIO35

Posted: Mon Dec 02, 2019 9:58 am
by progman.rus
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.

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

Posted: Mon Dec 02, 2019 8:29 pm
by idahowalker
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.

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

Posted: Tue Dec 03, 2019 2:11 am
by progman.rus
I do not write to GPIO39, GPIO36, GPIO34, GPIO35!!!
I only read. Look the code.