Hello,
we have a problem with the z-Stack SerialApp sampleapplication for CC2530.
We try to run UART1 and UART2 at the same time to connect a Battery Board from the DevelopmentKit with two UART devices.
We have already found out that the DMA is fixed at specific ports.
This is the part of the code in the hal_board_cfg.h where the DMA or ISR channel is selected:
#if HAL_UART
// Always prefer to use DMA over ISR.
#if HAL_DMA
#ifndef HAL_UART_DMA
#if (defined ZAPP_P1) || (defined ZTOOL_P1)
#define HAL_UART_DMA 1
#elif (defined ZAPP_P2) || (defined ZTOOL_P2)
#define HAL_UART_DMA 2
#else
#define HAL_UART_DMA 1
#endif
#endif
#define HAL_UART_ISR 0
#else
#ifndef HAL_UART_ISR
#if (defined ZAPP_P1) || (defined ZTOOL_P1)
#define HAL_UART_ISR 1
#elif (defined ZAPP_P2) || (defined ZTOOL_P2)
#define HAL_UART_ISR 2
#else
#define HAL_UART_ISR 1
#endif
#endif
#define HAL_UART_DMA 0
#endif
In the hal_uart.c the port is selected by the activated DMA-channel:
uint16 HalUARTWrite(uint8 port, uint8 *buf, uint16 len)
{
#if (HAL_UART_DMA == 1)
if (port == HAL_UART_PORT_0) return HalUARTWriteDMA(buf, len);
#endif
#if (HAL_UART_DMA == 2)
if (port == HAL_UART_PORT_1) return HalUARTWriteDMA(buf, len);
#endif
#if (HAL_UART_ISR == 1)
if (port == HAL_UART_PORT_0) return HalUARTWriteISR(buf, len);
#endif
#if (HAL_UART_ISR == 2)
if (port == HAL_UART_PORT_1) return HalUARTWriteISR(buf, len);
#endif
#if (HAL_UART_DMA == 0) && (HAL_UART_ISR == 0)
// UART is not enabled. Do nothing.
// Unused arguments
(void) port;
(void) buf;
(void) len;
#endif
return 0;
}
My question: is it possible to use both UART ports? Maybe by use of ISR at UART1 and DMA at UART2?
Any help would be appreciated.
Thanks a lot.