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.

UART on CC2650 (w/o TI RTOS) [SOLVED]

Other Parts Discussed in Thread: CC2650

Hello!

I have a SmartRF06 Evaluation Board equipped with a CC2650. I am trying to get the UART to work (EM_UART_RX and EM_UART_TX pins on dev evalaution board). This is what I tried, based on the blink_led example:


#define UART_BASE_ADDR UART0_BASEvoid UARTHandler(void); int main(void) { SysCtrlPowerEverything(); UARTDisable(UART_BASE_ADDR); UARTIntDisable(UART_BASE_ADDR, UART_INT_OE | UART_INT_BE | UART_INT_PE | UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX | UART_INT_CTS); UARTIntClear(UART_BASE_ADDR, UART_INT_OE | UART_INT_BE | UART_INT_PE | UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX | UART_INT_CTS); UARTIntRegister(UART_BASE_ADDR, UARTHandler); UARTFIFOLevelSet(UART_BASE_ADDR, UART_FIFO_TX1_8, UART_FIFO_RX1_8); IOCPinTypeUart(UART_BASE_ADDR, IOID_UNUSED, IOID_UNUSED, IOID_UNUSED, IOID_UNUSED); // use default parameters // Does SysCtrlClockGet() work here? UARTConfigSetExpClk(UART_BASE_ADDR, SysCtrlClockGet(), 115200, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE); UARTFIFOEnable(UART_BASE_ADDR); UARTEnable(UART_BASE_ADDR); UARTIntEnable(UART_BASE_ADDR, UART_INT_TX); ledInit(); ledOn(LED_PIN_1); char aChar = 'A'; while (1) { CPUdelay(1000000); UARTCharPut(UART_BASE_ADDR, aChar); // should print 'A' to UART ledToggle(LED_PIN_1); } } void UARTHandler(void) { UARTIntClear(UART_BASE_ADDR, UART_INT_OE | UART_INT_BE | UART_INT_PE | UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX | UART_INT_CTS); }

Unfortunately I do not receive anything. I also tried to change the interrupt handler directly in startup_gcc.c which didn't work either.
What am I doing wrong here?

What are the chances that the code of the PER test (which comes flashed onto evaluation board's chip) will be published? Currently it seems (?) rather hard to get along with the device without having any example (not using TI RTOS).

Thank you in advance,
Dominik

  • Moving to "Bluetooth Low Energy Forum"

    Regards,
    Gigi Joseph.
  • As I know, this UART functions need to be based on TI RTOS.
  • The UART works without TI RTOS. Everything should work without TI RTOS (I hope).

    I found the solution: I did not configure the UART pins correctly. From one of the TI files for the evaluation board with CC2650EM-71D I got the following:

    #define Board_UART_RX IOID_2
    #define Board_UART_TX IOID_3

    So the pin configuration that works for me is the following:

    IOCPinTypeUart(UART_BASE_ADDR, Board_UART_RX, Board_UART_TX, IOID_UNUSED, IOID_UNUSED);
  • Basically, I agree with you that it should work without TI RTOS. However, this is the information I get from TI FAE and I don't spend time to test them without TI RTOS. Thanks for the update that you make this work.
  • Hai dominik ,
    Iam also trying to do uart without rtos ,,, will u please share the code with me ???
  • This is a part of my test code (might not be optimal):


    #define Board_UART_RX IOID_2 #define Board_UART_TX IOID_3 #define Board_UART_CTS IOID_0 #define Board_UART_RTS IOID_21 #define UART_BASE_ADDR UART0_BASE //0x40001000

    uint32_t uartRead(uint8_t outBuf[], uint32_t bufSize, bool echo) {
        if (bufSize > 0) {  
            uint32_t bytesRead = 0;
            while (HWREG(UART_BASE_ADDR + UART_O_FR) & UART_FR_RXFE)   {    
                // wait until bytes are available
            }
            
            do {
                outBuf[bytesRead] = (uint8_t)(UARTCharGet(UART_BASE_ADDR) & 0xff);
                if (echo) {
                    UARTCharPut(UART_BASE_ADDR, outBuf[bytesRead]);
                }
                bytesRead++;
                CPUdelay(100000);
            } while ( (bytesRead < bufSize) && !(HWREG(UART_BASE_ADDR + UART_O_FR) & UART_FR_RXFE) );
            
            return bytesRead;
        } else {
            return 0;
        }       
    }
    
    #ifdef __cplusplus
    extern "C"
    {
    #endif    
    void UARTHandler(void) {
        UARTIntClear(UART_BASE_ADDR, UART_INT_OE | UART_INT_BE | UART_INT_PE |
        UART_INT_FE | UART_INT_RT | UART_INT_TX |
        UART_INT_RX | UART_INT_CTS);
    }
    #ifdef __cplusplus
    }
    #endif
    
    void uartInit(void){    
        UARTDisable(UART_BASE_ADDR);
    
        UARTIntDisable(UART_BASE_ADDR, UART_INT_OE | UART_INT_BE | UART_INT_PE |
        UART_INT_FE | UART_INT_RT | UART_INT_TX |
        UART_INT_RX | UART_INT_CTS);    
    
        UARTIntClear(UART_BASE_ADDR, UART_INT_OE | UART_INT_BE | UART_INT_PE |
        UART_INT_FE | UART_INT_RT | UART_INT_TX |
        UART_INT_RX | UART_INT_CTS);
    
        UARTIntRegister(UART_BASE_ADDR, UARTHandler);    
    
    
        UARTFIFOLevelSet(UART_BASE_ADDR, UART_FIFO_TX1_8, UART_FIFO_RX1_8);  // use FIFO?    
        IOCPinTypeUart(UART_BASE_ADDR, Board_UART_RX, Board_UART_TX, Board_UART_CTS, Board_UART_RTS); // use default parameters   
        UARTConfigSetExpClk(UART_BASE_ADDR, SysCtrlClockGet(), 115200, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);
    
        UARTFIFOEnable(UART_BASE_ADDR);
    
        UARTEnable(UART_BASE_ADDR);
        UARTIntEnable(UART_BASE_ADDR, UART_INT_TX | UART_INT_RX);    
    }

    However, this stuff is obsolete for us. We switched to Atmel SAM R21...