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.

TI-RTOS UART1 read problem(pins 16,17)

Other Parts Discussed in Thread: CC3200, UNIFLASH

Hello Everybody,

I have CC3200mod. UART1 on pins 16 (TX) and pin 17(RX).

MAP_PinTypeUART(PIN_16, PIN_MODE_2);

MAP_PinTypeUART(PIN_17, PIN_MODE_2);

If i run application based on TI-RTOS to read from UART1 - it does not work.

If i run a simple CCS application (without using of TI-RTOS) to read from UART1 - success

Please, help.

  • Gleb,
    Are you using the TI-RTOS UART driver? If so, can I see how you're using it?

    Regards,
    Moses
  • Hello  Moses,

    Yes, sure:

    app.cfg file:

    var UART = xdc.useModule('ti.drivers.UART');
    UART.libType = UART.LibType_NonInstrumented;

    Main.cpp file:

    Int main() {

    ...

    Board_initUART();

    ...

    Uart::Initialize();
    this->Uart::setWriteDataMode(UART_DATA_BINARY);
    this->Uart::setReadDataMode(UART_DATA_BINARY);
    this->Uart::setReadReturnMode(UART_RETURN_FULL);
    this->Uart::setReadEcho(UART_ECHO_OFF);
    this->Uart::setStopBits(UART_STOP_ONE);
    this->Uart::setParityType(UART_PAR_NONE);
    this->Uart::setDataLength(UART_LEN_8);
    //this->Uart::setReadTimeout(100);
    this->Uart::setBaudRate(9600);
    return this->Uart::Open();

    ..

    INITIALIZATION OF TASK (in task i try to read from UART)

    ..

    VStartSimpleLinkSpawnTask(3);

    BIOS_start(); /* does not return */
    return(0);

    }

    Thank you for trying to help me.

  • Gleb,
    I'm not seeing enough to know what's wrong. Are you writing a wrapper class for the UART driver? Can I see that code?
    To make things easy, I suggest you import our UART echo example and verify that it works. Let me know how that goes. Also, you can look at the source to see what we do there and what you might be doing differently.

    Let me know if this helps.

    Moses
  • Moses,

    I've tried to run uartecho_CC3200 example on UART1, but it also isn't working. Here the changes I've made:

    uartecho.c:

    Void echoFxn(UArg arg0, UArg arg1)

    {

       char input;

       UART_Handle uart;

       UART_Params uartParams;

       const char echoPrompt[] = "\fEchoing characters:\r\n";

       /* Create a UART with data processing off. */

       UART_Params_init(&uartParams);

       uartParams.writeDataMode = UART_DATA_BINARY;

       uartParams.readDataMode = UART_DATA_BINARY;

       uartParams.readReturnMode = UART_RETURN_FULL;

       uartParams.readEcho = UART_ECHO_OFF;

       uartParams.baudRate = 9600;

       uart = UART_open(Board_UART1, &uartParams);

       if (uart == NULL) {

           System_abort("Error opening the UART");

       }

       UART_write(uart, echoPrompt, sizeof(echoPrompt));

       /* Loop forever echoing */

       while (1) {

           UART_read(uart, &input, 1);

           UART_write(uart, &input, 1);

       }

    }

    pinmux.c:


    [07/03/2015 13:45] Archil Pirmisashvili:

    void PinMuxConfig(void)

    void PinMuxConfig(void)

    {

           //

        // Enable Peripheral Clocks

        //

           MAP_PRCMPeripheralClkEnable(PRCM_UARTA1, PRCM_RUN_MODE_CLK);

           MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);

           MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);

           MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);

     

           //

        // Configure PIN_07 for UART1 UART1_TX

        //

           MAP_PinTypeUART(PIN_07, PIN_MODE_0);

           MAP_PinTypeUART(PIN_16, PIN_MODE_7);

     

           //

        // Configure PIN_08 for UART1 UART1_RX

        //

           MAP_PinTypeUART(PIN_08, PIN_MODE_0);

           MAP_PinTypeUART(PIN_17, PIN_MODE_2);

     

           //

        // Configure PIN_55 for UART0 UART0_TX

        //

           MAP_PinTypeUART(PIN_55, PIN_MODE_3);

     

           //

        // Configure PIN_57 for UART0 UART0_RX

        //

           MAP_PinTypeUART(PIN_57, PIN_MODE_3);

     

           //

        // Configure PIN_64 for GPIO Output

        //

           MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);

           MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);

     

           //

        // Configure PIN_15 for GPIO Input

        //

           MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false);

           MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_IN);

    }

  • Gleb,

        First of all, what version of TI-RTOS are you using? In the tirtos_simplelink_2_10_01_38 which I'm using, UART1 pins are already configured in the PinMuxConfig function in the uartecho project. Looking at your Pinmux config changes, I see you're configuring 2 sets of UART1 pins (Pin_07 and Pin_16 for Tx and Pin_08 and Pin_17 for Rx). You only need to configure the one set you'll be using. Also I expected the UART1 pin modes for Pin_07 to be Pin_Mode_5 and for Pin_08 to be Pin_Mode_5 as well. There's a PinMux tool that can be used to graphically configure pins for the CC3200, I recommend using it to make things easier.

    Let  me know if this helps.

    Moses

  • Hello Moses,

    In previous code i sent you were a minor mistake in pinmux:

    MAP_PinTypeUART(PIN_16, PIN_MODE_2);        (and not PIN_MODE_7)

     

    I am using CC3200mod (and not cc3200 launchpad), tirtos_simplelink_2_01_00_03 version.

    UART1 of  CC3200 module connected to pins 16,17 (by document it requires to be on mode 2).

    I configured the pins correct because it works well on test program without TI-RTOS.

    But when i try to run TI-RTOS, UART1 does not work.

  • Gleb,
    Can you zip and attach your project?

    Regards,
    Moses
  • 6712.uartecho_CC3200.rar

    This is TI example i have switched UART0 to UART1 and changed pins according to my board.

    Thank you.

  • Gleb,

         Sorry for my delayed response. I've looked at your project, I haven't seen anything that stands out as wrong. I'm using a CC3200 Launchpad to test it. Pins 16 and 17 are the JTAG TDI and TDO pins respectively that's why we used Pins 7 and 8 for UART 1 in our pinmux config source. Are you loading and running the application with CCS (JTAG) or are you loading and booting from flash? Have you tested Pins 7 and 8 as UART1? Does UART0 which we use by default in the example work?

       Your post says "Read problem (pins 16, 17)" does this mean that the UART write works? How are you seeing it not working, is it hanging in the UART_read/UART_write or is UART_open failing?

    Regards,

    Moses

  • Hi Moses,

    We are using CC3200 module (not a launchpad), so we cannot check pins 7 and 8.

    Application is running correctly without TI-RTOS (UART1 and UART0 are working fine).

    But when we use TI-RTOS, UART1 is not working at all (not read and not write). UART0 still working fine!

    We are loading the application from flash!

    "Read problem" because we need to read from UART1 (write can be undefined at this moment).

    Our application tries to read from GPS (that connected to UART1), without TI-RTOS (CSS simple project) everything is fine (UART0 and UART1 are working correct). If we use TI-RTOS with the same pin definitions, UART1 is not working.

    We tried the simple echo application (from UART1 to UART0) with the same pin definition (the project was attached previously) and UART1 is not working.

    Thank you.

  • In continue to previous response:

    Today i tested UART1 on pins 7,8 (with TI-RTOS), everything is working fine (UART0 + UART1).
    But i need to fix UART1 on pins 16, 17 and the problem is still unresolved.

    Pins 16, 17 = TDI TDO.

    May be there is a TI-RTOS conflict between UART1 and TDI/TDO?
    Can i disable TDI/TDO?
  • Gleb,

        Are you using CCS to connect and debug? The TDI/TDO pins are part of the JTAG that's used by the CCS debugger. On the launchpad I'm using, the TDO/TDI pins are shorted to the emulator pins in Jumpers 10 and 11. If your board has something similar, you can remove the jumpers. You'll be disconnected from the JTAG but you can still program the device using the serial flash.

    Let me know if this helps.

    Regards,

    Moses

  • Moses,

    I am not using CCS debugger.
    I am flashing the unit with Uniflash over serial.

    Is there any configuration in TI-RTOS that uses TDI/TDO pins?
    May be i need to disable them anywhere?
  • TI-RTOS doesn't configure those pins. Have you removed the TDI and TDO jumpers on the board? The jumpers physically connects the pins to the JTAG emulator so it doesn't matter what configuration you do in software. I'm going to try replicating what you're doing and I'll let you know if it works for me.

    Regards,

    Moses

  • Moses,

    We have no TDI and TDO jumpers connected.

  • I have a simple UART echo working with UART1 on the launchpad using Pin16 and 17. I've attached my .out (remove the.txt extension). You can load and run this using CCS. Since Pins 16 and 17 are JTAG pins TDO and TDI you'll have to use SWD (2-wire JTAG) to connect to the device. The board settings for this include:

    • removing J10 and J11 jumpers on the JTAG header. These jumpers short Pins 16 and 17 to TDO and TDI respectively and so have to be removed.
    • the SOP[2..0] header should be set to 001 (only J17 should have a jumper).

    Finally your Target Configuration file (.ccxml) file should be changed from JTAG to SWD. To do this open your Target Configuration file and under the Advanced tab, set Port to SWD. Save the new setting and reconnect to the board and debug your application. The image below highlights the Target configuration changes:

    You'll need one of those FTDI serial to USB adapters to connect the UART pins (P16 and P17) to your host machine running a serial terminal. You should be able to type and have characters echoed back to the terminal.

    Let me know if this helps.

    Moses

    3225.uartecho_CC3200.out.txt