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.

RTOS/CC2650: Changing the UART pins during runtime

Part Number: CC2650


Tool/software: TI-RTOS

Dear friends,

I have to interface 3 devices to CC2650 using UART, since CC2650 have only one UART avilable.

Is it possible to change the UART pins during the program runtime?

Thanks

Regards, 

Tomvictor

  • Hi Tom,

    Unfortunately changing the pins during runtime is not supported. If you want to use UART on 3 devices, you will need to define 3 UART driver instances (which use the same peripheral they just define different pins) in your board files. Your application must also make sure no more than 1 instance is open at a particular time (you would need to open/close each instance when used). If you are ONLY writing to UART, this is feasible; however it will be a problem if asynchronous reads are expected.

    Hope this helps,
    -- Emmanuel
  • on initializationof UART, UART_config structure must me exist? (UART.h)
    and the the UART_config structure as follows(CC2650LAUNCHXL.c)

    /* UART hardware parameter structure, also used to assign UART pins */
    const UARTCC26XX_HWAttrsV2 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,
    .ringBufPtr = uartCC26XXRingBuffer[0],
    .ringBufSize = sizeof(uartCC26XXRingBuffer[0])
    }
    };

    /* UART configuration structure */
    const UART_Config UART_config[] = {
    {
    .fxnTablePtr = &UARTCC26XX_fxnTable,
    .object = &uartCC26XXObjects[0],
    .hwAttrs = &uartCC26XXHWAttrs[0]
    },
    {NULL, NULL, NULL}
    };


    The application code (echo example)

    Void echoFxn(UArg arg0, UArg arg1)
    {
    char input;
    UART_Handle uart;
    UART_Params uartParams,uart2Params;
    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_UART0, &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);
    }
    }
  • What all modifications I need to do for create multiple UART Instances for GPS AND GPRS? Is possible by two UART handlers and initialization and closing on each time before and after use?
    any suggestions, Thank you
  • Hi Tom,

    I might have another suggestion to solve your problem:

    If you are not using the Sensor Controller for anything else, you could use the Sensor Controller to generate three UART emulators. Each emulator would map its own IO pins. Only one emulator can run on the Sensor Controller, so you would not be able to communicate with two devices at the same time (but that probably won't be a problem for you).

    If that is something that you might consider, I suggest that you look at the Sensor Controller Studio which already has a UART emulator example with all the source code. You would just have to add the two additional tasks and map the additionnal IOs.

    Regards,
    Michel
  • Thank you, Michel.
    I have one more doubt. Does all the ble stack (for all examples) are same? How to start a project from scratch? every example projects itself consumes huge memmory any options for using external memmory?
    Thank you
  • Hi Tom,

    I am not sure I understand your question. You might be able to get a proper answer concerning  the stack on the BLE forum (link below):

    As for starting a project from scratch, TI offers several empty examples (if that's what you meant):

    In CCS, you can access them in the Resource Explorer from the View menu.

    You can also access the Resource Explorer online at the following address:

    I don't know enough about the BLE stack and the examples provided so if you wanted empty BLE examples, I would have to refer back to the BLE forum (or maybe a TI employee in the TI-RTOS forum)

    Regards,

    Michel