Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

cc2541 HAL UART intermittent data corruption

$
0
0

Hi All,

I must be doing something silly - I'd appreciate a look. This is my 1st time using HAL UART commands and I see intermittent data corruption. The failure rate can be changed by modifying the DEFAULT_ADVERTISING_INTERVAL so it looks like radio activity is creating occasional problems for the UART. 

Backing up, my setup is a cc2541EM on an RF05 board connected to a PC via RS232 cable. Software is the SimpleBLEPeripheral example that I added the HAL UART stuff to.

Test is a simple echo test - what I type on my Teraterm on the PC goes out and back. This mostly seems to be working, but I see failures (most often 0xff but not always) instead of the letter that I typed. When I leave DEFAULT_ADVERTISING_INTERVAL at the default of 160 the error rate is ~1.5%. If I change the interval to 1600 the error rate drops down to ~0.2%. The typing rate has no effect (I can type 1 character per second and still get errors).

Thanks for the look.

Preproc defines are as follows:

HAL_UART
HAL_UART_DMA=1
HAL_UART_ISR=0

In the SimpleBLEPeripheral_Init Routine my code is:


//Init the UART and open the port
HalUARTInit();
halUARTCfg_t uartConfig;

// configure UART
uartConfig.configured = TRUE;
uartConfig.baudRate = HAL_UART_BR_57600;
uartConfig.flowControl = FALSE;
uartConfig.flowControlThreshold = 48;
uartConfig.rx.maxBufSize = 10;
uartConfig.tx.maxBufSize = 10;
uartConfig.idleTimeout = 6;
uartConfig.intEnable = FALSE;
uartConfig.callBackFunc = (halUARTCBack_t)mfiCB;
portOpenStatus = 0;

// start UART
// Note: Assumes no issue opening UART port. TBD use portOpenStatus somehow
portOpenStatus = HalUARTOpen( HAL_UART_PORT_0, &uartConfig );

Here's the callback:

//MFi callback for handling stuff on the MFi Uart
void mfiCB (uint8 port, uint8 event) {
static uint8 *buf;
uint8 portWriteStatus, portReadStatus;

portReadStatus = HalUARTRead( HAL_UART_PORT_0, buf, 10 );

//Only Xmit if we read something
if (portReadStatus > 0 ) {
portWriteStatus = HalUARTWrite( HAL_UART_PORT_0, buf, portReadStatus );
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>