Open k-dedman opened 3 months ago
assume you checked the pins, some UARTS have non moveable UART functions (i.e the C6 UART2 has to be on 5 & 4) I submitted some changes which were included in 4.1.0 for UART2 specifically for the LP (Low-Power) UART which is UART2 on the C6 family. it may be these changes which are now jarring with the older (none LP) UARTS. look at uart.c (see dmx_art_init(), line ~341) , we may need some additional changes to check for non LP uarts, or only apply the recent changes ONLY for the C6
Thanks for the reply.
The problem is the code never gets to the point where it can set the pins for UART2, if i comment everything out but the dmx_driver_install for UART2, it still crashes.
I looked into the CONFIG_IDF_TARGET_ESP32C6 #ifdef's and commented out the code just to make sure it was initialising UART2 normally and it still crashes. The pins for UART2 should be remappable for the WT32-ETH01 dev board.
I have also made sure that I can setup a serial output on UART2 and that works, so the port can definitely be used.
I have got DMX output working for UART0 (tx pin 1), UART1 (tx pin 17 or 14), but I cannot get it to work on UART2
Ok I got it working.
Not sure whats going wrong but heres how I fixed it.
The program was failing whenever it hit uart_ll_set_sclk due to a null pointer at uart->dev I removed the check for including UART2 in the dmx_uart_t struct initialisation and the dmx port constant enum. I also explicitly defined &UART2 instead of using the UART_LL_GET_HW function.
static struct dmx_uart_t {
const int num;
uart_dev_t *const dev;
intr_handle_t isr_handle;
} dmx_uart_context[DMX_NUM_MAX] = {
{.num = 0, .dev = UART_LL_GET_HW(0)},
{.num = 1, .dev = UART_LL_GET_HW(1)},
// #if DMX_NUM_MAX > 2
{.num = 2, .dev = &UART2},
// #endif
};
/** @brief DMX port constants.*/
enum {
DMX_NUM_0, /** @brief DMX port 0.*/
DMX_NUM_1, /** @brief DMX port 1.*/
// #if SOC_UART_NUM > 2
DMX_NUM_2, /** @brief DMX port 2.*/
// #endif
DMX_NUM_MAX /** @brief DMX port max. Used for error checking.*/
};
I now have 3 seperate DMX TX outputs tested and working. Im not sure why this fix works as the ESP32 core should have 3 UARTS available and I had tested this with HardwareSerial.
Agree, I also in past versions had to code out the same struct #if test for UART2 and force it, although the latest code works for the LP UART on the C6. its been a nightmare for the latest esp-idf code rolls, they are making huge code changes around the LP UART, hence why I provided the new routines for UART2 init, its changed every time for the last 3 or 4 esp-idf library release (5.0 to 5.2+)
Hello! Got the same issue today with ESP-IDF and the v4.1.0 release, for an ESP32-S3. I fixed it with a small change in uart.c, line 32:
#if SOC_UART_NUM > 2
Currently DMX_NUM_MAX
is used, but it's an enum and cannot be used in pre-processor.
This sounds like a problem I have having as well. I have just tried to upgrade from 3.0.3-beta that I have been successfully using on esp-idf 4.4.5 with DMX_NUM_1 and DMX_NUM_2 as the 2 UARTS.
I am using an original ESP32-WROVER
Now I have 4.1.0 it crashes when trying to install the dmx driver for UART2. I have not changed the version of esp-idf.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
...
#0 0x400fb617:0x3ffb8240 in uart_ll_set_sclk at /Users/suffo_b/.platformio/packages/framework-espidf/components/hal/esp32/include/hal/uart_ll.h:76
(inlined by) dmx_uart_init at components/esp_dmx-4.1.0/src/dmx/hal/uart.c:357
#1 0x400f779d:0x3ffb8260 in dmx_driver_install at components/esp_dmx-4.1.0/src/dmx/driver.c:226
Seems the same as issue #150
https://github.com/someweisguy/esp_dmx/issues/150#issuecomment-2050224824
From: Ben Suffolk @.> Sent: Tuesday, June 11, 2024 5:32 PM To: someweisguy/esp_dmx @.> Cc: riwalker @.>; Comment @.> Subject: Re: [someweisguy/esp_dmx] Problem with installing DMX on UART2 (Issue #150)
This sounds like a problem I have having as well. I have just tried to upgrade from 3.0.3-beta that I have been successfully using on esp-idf 4.4.5 with DMX_NUM_1 and DMX_NUM_2 as the 2 UARTS.
I am using an original ESP32-WROVER
Now I have 4.1.0 it crashes when trying to install the dmx driver for UART2. I have not changed the version of esp-idf.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
..
(inlined by) dmx_uart_init at components/esp_dmx-4.1.0/src/dmx/hal/uart.c:357
— Reply to this email directly, view it on GitHub https://github.com/someweisguy/esp_dmx/issues/150#issuecomment-2161631189 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIKT5XPKLOZLNF37ZFMQVTZG5UDZAVCNFSM6AAAAABFKY2YKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRGYZTCMJYHE . You are receiving this because you commented. https://github.com/notifications/beacon/ABIKT5VA55XQGCIWLV7HDQLZG5UDZA5CNFSM6AAAAABFKY2YKCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUA27P5K.gif Message ID: @. @.> >
Hello! Got the same issue today with ESP-IDF and the v4.1.0 release, for an ESP32-C3. I fixed it with a small change in uart.c, line 32:
#if SOC_UART_NUM > 2
Currently
DMX_NUM_MAX
is used, but it's an enum and cannot be used in pre-processor.
Can confirm this is the correct solution and is working well. I have created a pull request for #158 for when @someweisguy has an opportunity to merge it.
Great, thanks! And just to correct myself, I'm using an ESP32-S3, not C3 (C3 only has 2 UARTs).
Hello! Got the same issue today with ESP-IDF and the v4.1.0 release, for an ESP32-C3. I fixed it with a small change in uart.c, line 32:
#if SOC_UART_NUM > 2
Any time I try to set up UART2 with dmx_driver_install the program crashes. I am trying to setup all 3 UART ports with a DMX output, I do not need RX or the enable pin. I have tried setting up UART2 on an ESP32-WROOM-32D and a WT32-ETH01 module, both modules crash when trying to setup UART2. UART0 & UART1 are working as intended. I have stripped my project to only setup UART2 and it still crashes. I am using Arduino IDE with esp_dmx 4.1.0