PSRAM changes IO behaviour of ESP32-CAM

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

PSRAM changes IO behaviour of ESP32-CAM

Postby esp-dev » Mon Jul 04, 2022 6:11 pm

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 4651 times
After enabling PSRAM
PSRAM_ENABLED.png
PSRAM_ENABLED.png (55.88 KiB) Viewed 4651 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?

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

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby ESP_Sprite » Tue Jul 05, 2022 1:39 am

Can you post your RMT code?

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby esp-dev » Tue Jul 05, 2022 4:29 pm

  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.

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

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby ESP_Sprite » Wed Jul 06, 2022 12:46 am

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.

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby esp-dev » Wed Jul 06, 2022 3:56 am

Here is the project file.
Attachments
ws_rmt.zip
(14.57 KiB) Downloaded 548 times

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby esp-dev » Wed Jul 06, 2022 3:14 pm

ESP_Sprite - Did you had a chance to take a look into the project file I've shared?

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

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby ESP_Sprite » Thu Jul 07, 2022 12:59 am

The RMT WS2811 driver itself is missing there?

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby esp-dev » Fri Jul 08, 2022 1:26 pm

You mean in the components dir?

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

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby ESP_Sprite » Fri Jul 08, 2022 2:48 pm

That zip file does not have a components dir when I download it?

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: PSRAM changes IO behaviour of ESP32-CAM

Postby esp-dev » Tue Jul 19, 2022 6:31 am

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));

Who is online

Users browsing this forum: No registered users and 136 guests