rg_system: Initialize and set high all SPI select lines as early as possible
Retro-Go initializes the SPI SD Card before anything else. If the LCD shares the bus and has a floating CS line, it could interfere with the initialization of the SD Card. So far it hasn't been a major issue (that I know of), but I can certainly see how it could be. Solution is to set all CS lines high as early as possible. See this link shared by mtojek: https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s2/api-reference/peripherals/sdspi_share.html (cherry picked from commit 85650702e29e031304ae00b6b478aa4e6fbc39de)
This commit is contained in:
parent
fdd72f63ed
commit
d9b0c17a9f
@ -359,6 +359,16 @@ static void platform_init(void)
|
||||
gpio_reset_pin(GPIO_NUM_14);
|
||||
gpio_reset_pin(GPIO_NUM_15);
|
||||
#endif
|
||||
// Setup all SPI CS lines here in case we have a shared bus. A floating device could cause
|
||||
// problems during the initialization of the first peripherals...
|
||||
#if defined(RG_SCREEN_HOST) && defined(RG_GPIO_LCD_CS)
|
||||
gpio_set_direction(RG_GPIO_LCD_CS, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(RG_GPIO_LCD_CS, 1);
|
||||
#endif
|
||||
#if defined(RG_STORAGE_SDSPI_HOST) && defined(RG_GPIO_SDSPI_CS)
|
||||
gpio_set_direction(RG_GPIO_SDSPI_CS, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(RG_GPIO_SDSPI_CS, 1);
|
||||
#endif
|
||||
#ifdef RG_GPIO_LED
|
||||
gpio_set_direction(RG_GPIO_LED, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(RG_GPIO_LED, 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user