This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IWR6843AOP: Generate UART interrupt (HWI)

Part Number: IWR6843AOP
Other Parts Discussed in Thread: IWR6843

Hi,

I am working on custom firmware based on the "Out-of-the-Box"-Firmware of the IWR6843AOP.

For a serial communication to an external device I try to use an interrupt on the UART.
For this, the pins are created as in the "out-of-the-box" demo and the UART is initialized.

/******************* PINMUX UART ******************************/
/* Setup the PINMUX to bring out the UART-1 */
    Pinmux_Set_OverrideCtrl(SOC_XWR6843AOP_PINU16_PADBE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
    Pinmux_Set_FuncSel(SOC_XWR6843AOP_PINU16_PADBE, SOC_XWR6843AOP_PINU16_PADBE_MSS_UARTA_TX);
    Pinmux_Set_OverrideCtrl(SOC_XWR6843AOP_PINV16_PADBD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
    Pinmux_Set_FuncSel(SOC_XWR6843AOP_PINV16_PADBD, SOC_XWR6843AOP_PINV16_PADBD_MSS_UARTA_RX);

and

    /* Setup the default UART Parameters */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.clockFrequency = gMmwMCB.cfg.platformCfg.sysClockFrequency;
    uartParams.baudRate       = gMmwMCB.cfg.platformCfg.commandBaudRate;
    uartParams.isPinMuxDone   = 1;
    uartParams.readTimeout    = 13;
    uartParams.readEcho       = UART_ECHO_OFF;
    uartParams.parityType     = UART_PAR_EVEN;

Before BIOS_start() is executed, a hardware interrupt is created with the following parameters:

    Hwi_Handle hwi0;
    Hwi_Params hwiParams;
    Error_Block eb;
    Error_init(&eb);
    Hwi_Params_init(&hwiParams);

    hwiParams.arg = 64;
    hwiParams.enableInt = 1;
    hwi0 = Hwi_create(5, &hwi0Fxn, &hwiParams, &eb);
    if (hwi0 == NULL) {
        System_abort("Hwi create failed");
    }

    Hwi_enableInterrupt(5);
    Hwi_enable();

The callback function is also inserted:

void hwi0Fxn(UArg arg){
    System_printf ("HWI 0", 0);
}

In a task the data is read bytewise from the Uart via

uartReadBytes = UART_read(gMmwMCB.commandUartHandle, &singleBuffer, 1);

However, the callback function is never executed.
The callback is to be used to toggle a GPIO for an rs485 communication later.
Do I have to set other values?

Best Regards
Felix

Further Information:
mmWave SDK: 3.5.0.4
Device: IWR6843AOP

  • Hi Felix

    Can you elaborate on where inputs such as SOC_XWR6843AOP_PINU16_PADBE or SOC_XWR6843AOP_PINV16_PADBD are defined?

    Regards,

    AG

  • Hi Akash,

    thank you for the quick reply.

    The Pinout of the IWR6843 and the IWR6843AOP are different so i need to use an other Pinmux setting as the in the Demo.
    I could not find an offical TI file in the SDK. For the beginning i use the configuartion shown by User QumJo from this thread.

    The Uart connection is working, i am abel to send an recevie data.
    I think iam missing some other settings for the interrupt.

    Are these settings correct?

    hwiParams.arg = 64;
    hwiParams.enableInt = 1;
    hwi0 = Hwi_create(5, &hwi0Fxn, &hwiParams, &eb);
    

    hwiParams.arg = 64: 64 is the default VIM interrupt channel for MSS_SCIA (UART1) level 0 interrupt (Page 274 in the Technical Reference Manual)
    hwiParams.enableInt = 1
    : to enable the interrupt
    Hwi_create(5, &hwi0Fxn, &hwiParams, &eb); 5 is an number of my choice to identfy the interrupt

    Do i have to set addidtion seetings, maybe in the UartSci driver?
    Or am i misunderstanding the interrupt mechanism in general? 

    Best Regards
    Felix

  • After some further research and tryouts i am some stepps further now.

    1. I am not able to create a HWI on the channel. This is because i'm using the Uart-Driver and it creates a HWI on this Channel.
      In this Driver a read or/and write Semaphore is created to block the Task while receiving/writing.
    2. A HWI would be create in the following way (from here):
          hwi0 = Hwi_create(64, &hwi0Fxn, &hwiParams, &eb);
      intNum    — interrupt number (VIM interrupt channel)
      hwiFxn     — pointer to ISR function
      params   — per-instance config params, or NULL to select default values (target-domain only)
      eb             — active error-handling block, or NULL to select default policy (target-domain only)

    But my Problem is not resolved.
    As I mentioned at the beginning, I need an interrupt when all data has been sent.
    Both UART_writePolling(...) and UART_write(...) seem to return before all data has been sent. It does not matter whether a DMA is used.

    Using following Code the GPIO_RS485DE will be written before all data has been sent.

    UART_writePolling(gMmwMCB.commandUartHandle,(uint8_t*) msgPayload, 300);
    GPIO_write(gMmwMCB.cfg.platformCfg.GPIO_RS485DE, 0U);
    
    

    But if a delay is inserted, the Pin will be written 'late enough'

    UART_writePolling(gMmwMCB.commandUartHandle,(uint8_t*) msgPayload, 300);
    Task_sleep(3);
    GPIO_write(gMmwMCB.cfg.platformCfg.GPIO_RS485DE, 0U);

    I think this not a good clean way to deal with the GPIO.
    Can you give me a better way to deal with this?

    Best Regards
    Felix

  • Hello again,

    i am still dealing with this problem.
    If no Task_sleep() is inserted, the GPIO will toggle before the UART-Write is completed. (A DMA is in use)

    UART_writePolling(gMmwMCB.commandUartHandle, emptymsgPayload, 720);
    GPIO_write(gMmwMCB.cfg.platformCfg.GPIO_RS485DE, 0U);

    Yellow: UART Tx
    Green: GPIO
    Blue:    RS485 Rx/TX-

    The image shows, the GPIO is toggled about 190usec to early.

    How can i avoid this behaivour?

    Additional question: If using UART_write(...) instead of UART_writePolling(...) only a small amount of bytes will be send, the GPIO also remains "high".
    Am i right, that this task might be aborted and not returned?

    Best Regards
    Felix

  • Hi Felix

    Apologies for the delay, I am still looking into why this is occurring for you.

    Please let us know if you have any updates on status.

    Regards,

    AG

  • Hello

     Can you please explain which are the two are you trying to generate

    1. external uart --> mmWave device --> generate HWI inside the mmWave device

    2.  <Reverse of #1>

    Are you trying to use the same pins as the uart ones to generate a Hardware interrupt to external world

    or

    Is the external world sending and interrupt to mmWave device.

    This should allow us to guide you better.

    Thank you

    Vaibhav

  • Hello,

    I use a RS485 Communication via UART. Therefor i need an "Drive Enable"-Pin to be able to send data per RS485.

    The problem is that the UART_Write method ends before all data has been sent.

    Please take a look  here.

    My first idea was, to use the UART interrupt, but this is not possible because the UART-Driver uses this interrupt.

    Is there a way to toggle the GPIO after all data has been sent?

    Best Regards
    Felix

  • Hi Felix

    You could use UART_writePolling in place of UART_write. Using the UART_writePolling waits until all bytes are sent before exiting the function, then you would be able to trigger your GPIO thereafter.

    The function is defined in the mmWave SDK at the following location:

    C:\ti\mmwave_sdk_03_05_00_04\packages\ti\drivers\uart\UART.h

     


    Regards,

    AG