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.

GenericApp UART_1 Writing to Port

Other Parts Discussed in Thread: CC2530EM

Hi,


Following a previous post on this topic ( http://e2e.ti.com/support/wireless_connectivity/f/158/t/324748 ) I have tried to follow the same procedure to write a message over UART_1 on p1_6 and p1_7 of the CC2530EM. I'm using Putty terminal program to view the output but I'm not getting anything.

I understand the code below omits the use of the callback function but all I want to to is do a basic test of the UART, I don't need to test for any special events.

My code uses the genericApp application in Z Stack Mesh and is as follows;

In genericApp.c :

void GenericApp_Init( uint8 task_id )
{

unsigned char str[]="Hello everybody";
halUARTCfg_t uartConfig;
uartConfig.configured = TRUE; // 2x30 don't care - see uart driver.
uartConfig.baudRate = HAL_UART_BR_115200;
uartConfig.flowControl = TRUE;
uartConfig.flowControlThreshold = 48; // 2x30 don't care - see uart driver.
uartConfig.rx.maxBufSize = 128; // 2x30 don't care - see uart driver.
uartConfig.tx.maxBufSize = 128; // 2x30 don't care - see uart driver.
uartConfig.idleTimeout = 6; // 2x30 don't care - see uart driver.
uartConfig.intEnable = TRUE; // 2x30 don't care - see uart driver.
uartConfig.callBackFunc = NULL;
HalUARTOpen (HAL_UART_PORT_1, &uartConfig);

HalUARTWrite(HAL_UART_PORT_1, str, 15);

}

I have enabled UART=TRUE in preprocessor.

  • For HAL_UART_PORT_1 to use Port 1 (Alt-2) you need to define HAL_UART_DMA=2.

    Another point is that in above code you have enabled flow control:
    uartConfig.flowControl = TRUE;

    In this case your HW also needs to connect the CTS (P1.4) and RTS (P1.5) signals.

    Regards,
    TC.
  • Hi,
    I disabled flow control - my mistake. Also disabled in Putty. However, where exactly do I need to define HAL_UART_DMA=2 ?

    I'm trying to get this working on a coordinator device. I'm also assuming no network needs to be setup such that the program won't hang before it gets to uart initialization?

    I also don't have anything better than a soc-bb 1.1 to work with so ztool isn't an option. I'm reading the uart through an mbed first and the to the terminal.

    I just need the simplest possible uart implementation on cc2530em then I can concentrate on transmitting my real data. Nothing works yet.

    Thanks for your patience.

    Ryan
  • You can define HAL_UART_DMA in hal_board_cfg.h.