Page 1 of 1

PSRAM changes IO behaviour of ESP32-CAM

Posted: Mon Jul 04, 2022 6:11 pm
by esp-dev
Hello,

I've been working with ESP32-CAM implementing the WS2812 with RMT. On the first deployment, the WS2812 works fine, but if I enable the PSRAM (required for accessing cam) the IO behaviour is uncertain.

I'm using IO33 as my signal pin to WS2812. While probing that IO the behaviour is shown.

Before enabling PSRAM
PSRAM_NOT_ENABLED.png
PSRAM_NOT_ENABLED.png (31.87 KiB) Viewed 6050 times
After enabling PSRAM
PSRAM_ENABLED.png
PSRAM_ENABLED.png (55.88 KiB) Viewed 6050 times
My CPU core is running at 240MHz and the flash size is 4MB

What am I missing? Any additional configurations required to work with PSRAM?

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Tue Jul 05, 2022 1:39 am
by ESP_Sprite
Can you post your RMT code?

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Tue Jul 05, 2022 4:29 pm
by esp-dev
  1. void setup_rmt_data_buffer(rgbVal *pixels)
  2. {
  3.   // --
  4.   for (uint32_t led = 0; led < NUM_LEDS; led++) {
  5.     uint32_t bits_to_send = 0;
  6.     bits_to_send += (pixels[led].r) << 8;
  7.     bits_to_send += (pixels[led].g);
  8.     bits_to_send += (pixels[led].b) << 16;
  9.  
  10.     uint32_t mask = 1 << (BITS_PER_LED_CMD - 1);
  11.     for (uint32_t bit = 0; bit < BITS_PER_LED_CMD; bit++) {
  12.       uint32_t bit_is_set = bits_to_send & mask;
  13.       led_data_buffer[led * BITS_PER_LED_CMD + bit] = bit_is_set ?
  14.                                                       (rmt_item32_t){{{T1H, 1, TL, 0}}} :
  15.                                                       (rmt_item32_t){{{T0H, 1, TL, 0}}};
  16.       mask >>= 1;
  17.     }
Here is where I'm generating the timing. Let me know if this helps.

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Wed Jul 06, 2022 12:46 am
by ESP_Sprite
Nothing particularily wrong there. Can you post your entire project, perhaps? It's odd that the two waveforms seem to be the exact inverse of eachother.

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Wed Jul 06, 2022 3:56 am
by esp-dev
Here is the project file.

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Wed Jul 06, 2022 3:14 pm
by esp-dev
ESP_Sprite - Did you had a chance to take a look into the project file I've shared?

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Thu Jul 07, 2022 12:59 am
by ESP_Sprite
The RMT WS2811 driver itself is missing there?

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Fri Jul 08, 2022 1:26 pm
by esp-dev
You mean in the components dir?

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Fri Jul 08, 2022 2:48 pm
by ESP_Sprite
That zip file does not have a components dir when I download it?

Re: PSRAM changes IO behaviour of ESP32-CAM

Posted: Tue Jul 19, 2022 6:31 am
by esp-dev
ESP_Sprite - Thanks for looking into the file I provided. I managed to get it working with PSRAM enabled after changing ws2812_control_init().

Code: Select all

rmt_config_t config = RMT_DEFAULT_CONFIG_TX(LED_RMT_TX_GPIO, LED_RMT_TX_CHANNEL);
config.clk_div = 2;
ESP_ERROR_CHECK(rmt_config(&config));
ESP_ERROR_CHECK(rmt_driver_install(config.channel, 0, 0));