ESP32-S3 LCD_CAM PERIPHERAL HELP

Baldhead
Posts: 468
Joined: Sun Mar 31, 2019 5:16 am

ESP32-S3 LCD_CAM PERIPHERAL HELP

Postby Baldhead » Tue Dec 14, 2021 5:54 pm

Hi,

As there is still no documentation on the LCD_CAM peripheral, i would like espressif help me with this peripheral.

Below are the codes that apparently are working and the code that is not working.
Can i only send data with the data/command pin = 1 through gdma ?

Code apparently it's working to send a command:
* Clock io pin = OK
* data/command io pin = 0 (ok).
* chip select io pin = always 0.
* data 0.....7 io pins = ok.

Code: Select all

inline void hw_lcd_write_command( uint32_t command )      
{
    LCD_CAM.lcd_user.lcd_cmd = 1;   // R/W; bitpos: [26]; default: 0. 1: Be able to send command in LCD sequence when LCD starts. 0: Disable.  
    LCD_CAM.lcd_user.lcd_dout = 0;  // R/W; bitpos: [24]; default: 0. 1: Be able to send data out in LCD sequence when LCD starts. 0: Disable.      
    
    LCD_CAM.lcd_cmd_val.lcd_cmd_value = command;  // lcd_cmd_value : R/W; bitpos: [31:0]; default: 0. The LCD write command value. 
        
    LCD_CAM.lcd_user.lcd_update = 1;  // R/W; bitpos: [20]; default: 0. 1: Update LCD registers, will be cleared by hardware. 0 : Not care. Update parameters before start transaction.
    LCD_CAM.lcd_user.lcd_start = 1;   // R/W; bitpos: [27]; default: 0. LCD start sending data enable signal, valid in high level.
}

Code not working to send a parameter with data/command pin = 1 without gdma.
* Clock io pin = OK i think ( "2 clock cycles with LCD_CAM.lcd_user.lcd_always_out_en = 0" , and 1 clock cycle with LCD_CAM.lcd_user.lcd_always_out_en = 1" ).
* data/command io pin = 1 (ok).
* chip select io pin = always 0.
* data 0.....7 io pins = NOT OK, no output data.

Code: Select all

inline void hw_lcd_write_data( uint32_t data )      
{
    LCD_CAM.lcd_user.lcd_cmd = 0;   // R/W; bitpos: [26]; default: 0. 1: Be able to send command in LCD sequence when LCD starts. 0: Disable.  
    LCD_CAM.lcd_user.lcd_dout = 1;  // R/W; bitpos: [24]; default: 0. 1: Be able to send data out in LCD sequence when LCD starts. 0: Disable.
            
    LCD_CAM.lcd_cmd_val.lcd_cmd_value = data;  // R/W; bitpos: [31:0]; default: 0. The LCD write command value. 
      
    LCD_CAM.lcd_user.lcd_update = 1;  // R/W; bitpos: [20]; default: 0. 1: Update LCD registers, will be cleared by hardware. 0 : Not care. Update parameters before start transaction.
    LCD_CAM.lcd_user.lcd_start = 1;   // R/W; bitpos: [27]; default: 0. LCD start sending data enable signal, valid in high level.
}
Thank's for the help.

Baldhead
Posts: 468
Joined: Sun Mar 31, 2019 5:16 am

Re: ESP32-S3 LCD_CAM PERIPHERAL HELP

Postby Baldhead » Wed Dec 15, 2021 9:01 pm

Hi,

750 nanoseconds to start send a command to LCD_CAM io.

2,7 microseconds to service LCD_CAM interrupt.

Is that correct ?

How can i decrease the interrupt latency in LCD_CAM interrupt ?

Thank's.

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

Re: ESP32-S3 LCD_CAM PERIPHERAL HELP

Postby ESP_Sprite » Thu Dec 16, 2021 2:49 am

That sounds about right, honestly. Interrupts on the ESP32/Xtensa aren't that fast I'm afraid.

Baldhead
Posts: 468
Joined: Sun Mar 31, 2019 5:16 am

Re: ESP32-S3 LCD_CAM PERIPHERAL HELP

Postby Baldhead » Thu Dec 16, 2021 6:55 pm

Baldhead wrote:
Tue Dec 14, 2021 5:54 pm
Code not working to send a parameter with data/command pin = 1 without gdma.
* Clock io pin = OK i think ( "2 clock cycles with LCD_CAM.lcd_user.lcd_always_out_en = 0" , and 1 clock cycle with LCD_CAM.lcd_user.lcd_always_out_en = 1" ).
* data/command io pin = 1 (ok).
* chip select io pin = always 0.
* data 0.....7 io pins = NOT OK, no output data.

Code: Select all

inline void hw_lcd_write_data( uint32_t data )      
{
    LCD_CAM.lcd_user.lcd_cmd = 0;   // R/W; bitpos: [26]; default: 0. 1: Be able to send command in LCD sequence when LCD starts. 0: Disable.  
    LCD_CAM.lcd_user.lcd_dout = 1;  // R/W; bitpos: [24]; default: 0. 1: Be able to send data out in LCD sequence when LCD starts. 0: Disable.
            
    LCD_CAM.lcd_cmd_val.lcd_cmd_value = data;  // R/W; bitpos: [31:0]; default: 0. The LCD write command value. 
      
    LCD_CAM.lcd_user.lcd_update = 1;  // R/W; bitpos: [20]; default: 0. 1: Update LCD registers, will be cleared by hardware. 0 : Not care. Update parameters before start transaction.
    LCD_CAM.lcd_user.lcd_start = 1;   // R/W; bitpos: [27]; default: 0. LCD start sending data enable signal, valid in high level.
}
@ESP_Sprite,

Could you help me with this ?

Baldhead
Posts: 468
Joined: Sun Mar 31, 2019 5:16 am

Re: ESP32-S3 LCD_CAM PERIPHERAL HELP

Postby Baldhead » Thu Dec 16, 2021 7:05 pm

Hi @ESP_Sprite,

A strange thing happens in this code below.

I am monitoring, with a oscilloscope, the clock and data pin bit 1.

The data pin bit 1 should be alternating infinitely, but sometimes, the pin print two consecutive 0 or sometimes two consecutive 1.
The problem occurs randomly, sometimes the pin alternates 11 times, sometimes 48 times, sometimes another value, until the problem appears.

What can be wrong ?

Thank's.

Code: Select all

void app_main(void)
{  
    hw_lcd_init();
    
    while(1)
    {
        hw_lcd_write_command( 0xAA );
        vTaskDelay( pdMS_TO_TICKS(500) );

        hw_lcd_write_command( 0x55 );
        vTaskDelay( pdMS_TO_TICKS(500) );    
    }
}


inline void hw_lcd_write_command( uint32_t command )      
{
    hw_lcd_clear_transfer_end_interrupt_status();  // LCD_CAM.lc_dma_int_clr.lcd_trans_done_int_clr = 1;   interrupt disabled.    

    LCD_CAM.lcd_user.lcd_cmd = 1;   // R/W; bitpos: [26]; default: 0. 1: Be able to send command in LCD sequence when LCD starts. 0: Disable.  
    LCD_CAM.lcd_user.lcd_dout = 0;  // R/W; bitpos: [24]; default: 0. 1: Be able to send data out in LCD sequence when LCD starts. 0: Disable.        
    
    LCD_CAM.lcd_cmd_val.lcd_cmd_value = command;  // lcd_cmd_value : R/W; bitpos: [31:0]; default: 0. The LCD write command value. 
        
    LCD_CAM.lcd_user.lcd_update = 1;  // R/W; bitpos: [20]; default: 0. 1: Update LCD registers, will be cleared by hardware. 0 : Not care. Update parameters before start transaction.
    LCD_CAM.lcd_user.lcd_start = 1;   // R/W; bitpos: [27]; default: 0. LCD start sending data enable signal, valid in high level.
   
    while( hw_lcd_transfer_done_status() );  // !LCD_CAM.lc_dma_int_raw.lcd_trans_done_int_raw;  interrupt disabled. polling flag.
}

ParkSun
Posts: 3
Joined: Mon May 16, 2022 10:40 am

Re: ESP32-S3 LCD_CAM PERIPHERAL HELP

Postby ParkSun » Sun Jun 05, 2022 8:03 pm

In the file "espressif/esp32-camera/target/esp32s3/ll_cam.c" can anyone explain how the registers in "soc/lcd_cam_reg.h" are actually accessed? The register header is included but I don't see anywhere it's used. I do see in another header file "soc/lcd_cam_struct.h" where register structures are created but I don't see how they connect to the actual register definitions.

In short I'm trying to figure out how the low level registers are actually accessed by the given example code.

Who is online

Users browsing this forum: No registered users and 105 guests