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.

CC2640: CC2640 Pullup a UART Rx pin

Part Number: CC2640
Other Parts Discussed in Thread: LAUNCHXL-CC2650, CC2650

Hi everyone,


I need to pullup a UART Rx pin (IOCFG8: PULL_CTL = 0x2).
But after calling UART_open() IOCFG8 is set: PULL_CTL = 0x3
What am I doing wrong?

 Board_UART_RX | PIN_INPUT_EN | PIN_PULLUP,   



//Init & Open  UART
void UART_Init(void){
  UART_Params_init(&params);
  params.baudRate = 2400;
  params.stopBits = UART_STOP_ONE;
  params.parityType = UART_PAR_NONE;
  params.writeDataMode = UART_DATA_BINARY;
  params.readDataMode = UART_DATA_BINARY;
  params.readMode = UART_MODE_CALLBACK;
  params.readCallback = UART_ReadCB;
  handle = UART_open(Board_UART, &params);  // Open the UART and do the read

}



  • Hi,

    Thank you for reaching out of us,

    Where did you make you changes?

    On my side, in the uart2echo example located in your sdk, I'm able to set the pin in pull up mode in the BoardGpioInitTable function located in the CC2640R2_LAUNCHXL.c file as shown below.

    Can you share your example and double check that there are no others functions overwriting the pin?

    regards,

  • Hello  Guillaume ,

    I have a custom board by CC2640RGZR   7*7


    /* UART Board */
    #define Board_UART_RX               IOID_8          /* RXD  */

    ..........

    const PIN_Config BoardGpioInitTable[] = {
     Board_UART_RX | PIN_INPUT_EN | PIN_PULLUP,                //!!!    
     Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
     PIN_TERMINATE
    }

    .......

    static void UART_ReadCB(UART_Handle handle, void *rxBuf, size_t size){
      Flag_UART_Read_Ready = true;
    }

    .......

    //Init & Open  UART
    void My_UART_Init(void){
      UART_Params_init(&params);
      params.baudRate = 2400;
      params.stopBits = UART_STOP_ONE;
      params.parityType = UART_PAR_NONE;
      params.writeDataMode = UART_DATA_BINARY;
      params.readDataMode = UART_DATA_BINARY;
      params.readMode = UART_MODE_CALLBACK;
      params.readCallback = UART_ReadCB;


      handle = UART_open(Board_UART, &params);

    }




    In main.c, after calling the PIN_init(BoardGpioInitTable) function,      IOCFG8:PULL_CTL=0x2    is set.
    UART Rx pin set pullup


    But after calling the function handle=UART_open(Board_UART, &params);
    IOCFG8:PULL_CTL=0x3

    UART Rx pin is not set by pullup

    Where can i see an example of UART Rx PULLUP for LAUNCHXL-CC2650 (ble_sdk_2_02_01_18)  ?

    Regards,

  • Hello Alex,

    Can you provide me your UART config for your custom board, you can find the example I'm searching for in the CC2640R2_LAUNCHXL.c file of the uartecho example, see the picture below.

    Make sure that the .rxpin parameters is set with your custom board define for UART_RX.

    Unfortunately we do not have a specific example of UART Rx PULLUP for LAUNCHXL-CC2650.

    The way to pullup the pin is the one you did.

    regards,

  • Hi  Guillaume ,

    /* UART hardware parameter structure, also used to assign UART pins */
    const UARTCC26XX_HWAttrsV1 uartCC26XXHWAttrs[CC2650_LAUNCHXL_UARTCOUNT] = {
        {
            .baseAddr       = UART0_BASE,
            .powerMngrId    = PowerCC26XX_PERIPH_UART0,
            .intNum         = INT_UART0_COMB,
            .intPriority    = ~0,
            .swiPriority    = 0,
            .txPin          = Board_UART_TX,
            .rxPin          = Board_UART_RX,
            .ctsPin         = PIN_UNASSIGNED,
            .rtsPin         = PIN_UNASSIGNED
        }
    };



    /* UART Board */
    #define Board_UART_RX               IOID_8          /* RXD  */
    #define Board_UART_TX               IOID_9          /* TXD  */
    #define Board_UART_CTS              PIN_UNASSIGNED  /* CTS  */
    #define Board_UART_RTS              PIN_UNASSIGNED  /* RTS */


    Regards,

  • Hi Alex,

    Before going any further, I wonder why you need to pull up this pin. By default rx could has no pull and works properly as well.

    If all the others steps will not work, the only way will be to directly write it on the register, but we need first to know why you want to pull up it.

    regards,


  • Hello  Guillaume ,

    I am using UART for half duplex mode  RS-485 Modbus RTU on ADM2587E.
    I can connect an external pullup resistor. But the custom board is already done.
    Pins DE and /RE ADM2587E are connected.
    When receiving UART Rx the pin is floating. So need pullup
    Function UART_ReadCB(handle, RxBuf, size) returns an error.
    Solving the problem with "UART_ReadCancel...UART_Read" did not work

    "...the only way will be to directly write it on the register.." will give an extra impulse on the Rx pin.


    void Modbus_FunRsp (uint8_t fun){
     //UART_readCancel (handle);     
      DE_ON;                          //ADM2587 for write
      UART_write(handle, buf, 8);  
      Task_sleep(50000)          //time for frame transfering  (debug)
      DE_OFF;
     //UART_Read();           //ADM2586 for recieve
    }


    Regards,

  • Hello,

    I will forward your request to a relevant expert, did you consider to keep the default pull down on the rx pin?

    regards,

  • It's possible to copy the C:\ti\simplelink_cc2640r2_sdk_5_30_00_03\source\ti\drivers\uart\UARTCC26XX.c resource directly into your project to overwrite the existing reference.  Then you can then modify UARTCC26XX_initIO locally to add PIN_PULLUP to the table's RX pin, which is used when opening and assigning pins for UART operation.

    /*
     *  ======== UARTCC26XX_initIO ========
     *  This functions initializes the UART IOs.
     *
     *  @pre    Function assumes that the UART handle is pointing to a hardware
     *          module which has already been opened.
     */
    static bool UARTCC26XX_initIO(UART_Handle handle) {
        /* Locals */
        UARTCC26XX_Object               *object;
        UARTCC26XX_HWAttrsV2 const     *hwAttrs;
        PIN_Config                      uartPinTable[5];
        uint32_t i = 0;
    
        /* Get the pointer to the object and hwAttrs */
        object = handle->object;
        hwAttrs = handle->hwAttrs;
    
        /* Build local list of pins, allocate through PIN driver and map HW ports */
        uartPinTable[i++] = hwAttrs->rxPin | PIN_INPUT_EN; //ADD PIN_PULLUP HERE
        /* Make sure UART_TX pin is driven high after calling PIN_open(...) until
        *  we've set the correct peripheral muxing in PINCC26XX_setMux(...)
        *  This is to avoid falling edge glitches when configuring the UART_TX pin.
        */
        uartPinTable[i++] = hwAttrs->txPin | PIN_INPUT_DIS | PIN_PUSHPULL |
                PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH;

    Regards,
    Ryan

  • Hello experts,

    Please give an example of direct writing and reading to register  IOCFGx : PULL_CTL
    Where can I find documentation on this subject?

    Sincerely

  • This involves using HWREG to directly read/write a register.  You can refer to IOCIOPortOPullSet and IOC registers from the Driverlib Documentation.

    Regards,
    Ryan