imx93evk Zephyr RS485

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx93evk Zephyr RS485

334 Views
zefox
Contributor II

Hi,

 

I have been working on this issue for 2 days now and I am not progressing anymore. I am trying to use OSDP in Zephyr through the control_panel example. I have provided my files in the zip I attached below. 

My wiring is as follows:

zefox_0-1759916096527.png

 

 


I have checked that the GPIO17 is indeed multiplexed correctly. This is correct.
I have tried using pull-down resistors (10K) on the DE&/RE pin. Didn't do anything.
I have tried sending test data directly using the serial driver in Zephyr. Didn't work.

I can tell it is sending correctly because my reader is correctly receiving a message. But the DE pin always stays high. This means it won't receive anything. Which is exactly what I am observing. 

I have had this issue with the STmicroelectronics UART driver as well where the hardware-controlled DE pin had the same issue. 

How do i fix this issue

0 Kudos
Reply
1 Reply

287 Views
zefox
Contributor II

i was able to fix this issue by implementing the following:

static void rs485_enable_runtime(void)
{
    const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(lpuart3));
    struct uart_config cfg;

    if (!device_is_ready(dev)) {
        printk("lpuart3 not ready\n");
        return;
    }

    if (uart_config_get(dev, &cfg) == 0) {
        cfg.flow_ctrl = UART_CFG_FLOW_CTRL_RS485;  // RS-485 via DE/RTS
        if (uart_configure(dev, &cfg) != 0) {
            printk("uart_configure RS-485 failed\n");
        }
    }
}

 

The issue was caused by a bit not being set correctly in the A55 core's register. This, to me, points to an issue in the driver. 

 

Tags (2)
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2181760%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx93evk%20Zephyr%20RS485%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2181760%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20have%20been%20working%20on%20this%20issue%20for%202%20days%20now%20and%20I%20am%20not%20progressing%20anymore.%20I%20am%20trying%20to%20use%20OSDP%20in%20Zephyr%20through%20the%20control_panel%20example.%20I%20have%20provided%20my%20files%20in%20the%20zip%20I%20attached%20below.%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20wiring%20is%20as%20follows%3A%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22zefox_0-1759916096527.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22zefox_0-1759916096527.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359872i8475F635EDFA8242%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22zefox_0-1759916096527.png%22%20alt%3D%22zefox_0-1759916096527.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3E%3CBR%20%2F%3EI%20have%20checked%20that%20the%20GPIO17%20is%20indeed%20multiplexed%20correctly.%20This%20is%20correct.%3CBR%20%2F%3EI%20have%20tried%20using%20pull-down%20resistors%20(10K)%20on%20the%20DE%26amp%3B%2FRE%20pin.%20Didn't%20do%20anything.%3CBR%20%2F%3EI%20have%20tried%20sending%20test%20data%20directly%20using%20the%20serial%20driver%20in%20Zephyr.%20Didn't%20work.%3C%2FP%3E%3CP%3EI%20can%20tell%20it%20is%20sending%20correctly%20because%20my%20reader%20is%20correctly%20receiving%20a%20message.%20But%20the%20DE%20pin%20always%20stays%20high.%20This%20means%20it%20won't%20receive%20anything.%20Which%20is%20exactly%20what%20I%20am%20observing.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20had%20this%20issue%20with%20the%20STmicroelectronics%20UART%20driver%20as%20well%20where%20the%20hardware-controlled%20DE%20pin%20had%20the%20same%20issue.%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20i%20fix%20this%20issue%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183866%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx93evk%20Zephyr%20RS485%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183866%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ei%20was%20able%20to%20fix%20this%20issue%20by%20implementing%20the%20following%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Estatic%3C%2FSPAN%3E%20%3CSPAN%3Evoid%3C%2FSPAN%3E%20%3CSPAN%3Ers485_enable_runtime%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Evoid%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3Econst%3C%2FSPAN%3E%20%3CSPAN%3Estruct%3C%2FSPAN%3E%20%3CSPAN%3Edevice%3C%2FSPAN%3E%20%3CSPAN%3E*%3C%2FSPAN%3E%3CSPAN%3Edev%3C%2FSPAN%3E%20%3CSPAN%3E%3D%3C%2FSPAN%3E%20%3CSPAN%3EDEVICE_DT_GET%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3EDT_NODELABEL%3C%2FSPAN%3E%3CSPAN%3E(lpuart3))%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3Estruct%3C%2FSPAN%3E%20%3CSPAN%3Euart_config%3C%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AN%3Eprintk%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%22uart_configure%20RS-485%20failed%3C%2FSPAN%3E%3CSPAN%3E%5Cn%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3E)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CP%3EThe%20issue%20was%20caused%20by%20a%20bit%20not%20being%20set%20correctly%20in%20the%20A55%20core's%20register.%20This%2C%20to%20me%2C%20points%20to%20an%20issue%20in%20the%20driver.%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E