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.

CC3220SF: RXD disable by UART_control() fail, but register “CTL” can disable RXD, why?

Part Number: CC3220SF

Hi, Support Team,

 

Our product use CC3220SF SoC. SimpleLink-SDK version: simplelink_cc32xx_sdk_4_30_00_06. Use TI-RTOS.

 

My question:

  1. I use JTAG and break at Line 169,

UART_control(uartHandle, UART_CMD_RXDISABLE, NULL); and UART RXD still receive another new data by callback function.

I observe the register “CTL” = 0x…. 301.  So I directly modify value 101, then RXD disable successfully. Why UART_control(uartHandle, UART_CMD_RXDISABLE, NULL); fail ?

==================================

CC3220 Technical Reference Manual, document number: SWRU465, page 166 and 167.

Best Regards,

Lishen

  • Hi Lishen,

    I went into the driver to find what exactly the "UART_CMD_RXDISABLE" does. Here is the code snippet:

    Note that the driver only disables the interrupts, not from the UARTCTL register. If you want to disable the UART RX, you will have to set that bit yourself. 

  • Dear Sabeeh Khan1,

    My question:

    1. My code base from Network_terminal demo code.   Now, I remove all “UART_control(uartHandle, UART_CMD_RXENABLE, NULL);”, and I set breakpoint at uart read callback function “uartreadcallback_JMEX()”. I use another program “Terminal v1.9b” and send data to CC3220SF. I find uart read callback function entry, why ?   I have no enable RX interrupt anywhere.

    My uart_term.c and initial code as bellows:

    //                 GLOBAL VARIABLES
    UART_Handle uartHandle;
    
    UART_Handle InitTerm(void)
    {
        UART_Params       uartParams;
        UART_init();
        UART_Params_init(&uartParams);
      
      if( IsFlag1(g_u8_EntryProductionStatus, (uint8_t)gd_Skip_originUARTPrint) )
      { // Settings for Production Mode only.
        uartParams.readMode = UART_MODE_CALLBACK;
        uartParams.writeMode = UART_MODE_BLOCKING;
        uartParams.readCallback = uartreadcallback_JMEX;
        uartParams.readReturnMode = UART_RETURN_FULL;
        uartParams.readDataMode = UART_DATA_BINARY;
        uartParams.writeDataMode = UART_DATA_BINARY;
        uartParams.readEcho = UART_ECHO_OFF;
        uartParams.baudRate = 115200;
        uartParams.dataLength = UART_LEN_8;
        uartParams.stopBits = UART_STOP_ONE;
        uartParams.parityType = UART_PAR_NONE;
      }
    
        uartHandle = UART_open(CONFIG_UART_0, &uartParams);
    
      UART_control(uartHandle, UART_CMD_RXDISABLE, NULL); //callback function will not working. so this is disable RX interrupt.
    
        return(uartHandle);
    }
    
    // uart read callback function
    void uartreadcallback_JMEX(UART_Handle handle, void *buffer, size_t count)
    {
        numBytesRead = count;
        sem_post(&UART_Receive);
    }
    

    Could you tell me how to check another code maybe effect UART read action ?

    Best Regards,

    Lishen

  • Hi Lishen, I will get back to you next week. 

  • Hi Lishen,

    Is this still an issue?

  • Dear Sebeeh Khan1,

    RXD still active if UART_control(uartHandle, UART_CMD_RXDISABLE, NULL);.

    May I know that UART_control(uartHandle, UART_CMD_RXDISABLE, NULL) command, which register will be change??

    Because I use "HWREG(UARTA0_BASE + UART_O_CTL) = HWREG(UARTA0_BASE + UART_O_CTL) & ~(0x00000200);", RXD stop receive data from callback function.

    According to TI document No. SWRU465, Technical Reference Manual, Page 166, UARTCTL Register(Offset = 30h), Bit9(RXE) : UART Receive Enable. 0: receive section of UART is disabled.

    It is work when I use HWREG(....). But I do not know UART_control(..., UART_CMD_RXDISABLE, NULL) control which register?

    Best Regards,

    Lishen

  • Hi Lishen,

    The TI Drivers are open sourced, you can find exactly how the UART driver works, and the registers it sets. The code snippet I posted above was from this path: <SDK_INSTALL_DIR>/source/ti/drivers/uart/UARTCC32XX.c. 

    For finding what registers UARTIntDisable sets, see snippet from <SDK_INSTALL_DIR>/source/ti/devices/cc32xx/driverlib/uart.c:

    If you want to stop UART all together, you should use UART_close(). 

    Please also try this in blocking mode. 

  • Dear Sabeeh Khan1,

    Thanks for your answer UART_Control() source code. I tracking the UARTA0 register IM value always 0000. But my read callback function still working.

    It is vary strange to me.

    But now I set another flag in my code, if service UART command now then put RXD to dummy variables. 

    Best Regards,

    Lishen

  • You will still be able to receive characters, that's intended. The RXDISABLE CMD is used to disable RX from the LPDS dependency. 

    If you would need to stop receive characters, either use Close() or set the CTL register manually. 

  • Dear Sabeeh Khan1,

    Thanks! After production test function ready, I will test register with network terminal demo code again.

    Because I can set command "UART_CMD_DISABLE" in example code uartecho, but fail in my code base.

    Best Regards,

    Lishen