yabo国际娱乐对话半导体客户支持- uart da14681块 https://support.dialog-semiconductor.com/resource-keywords/uart-da14681-block 经过几次尝试后,UART读取失败 https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/uart-read-fails-after-few-attempts < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”属性= " rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p >我想创建一个任务,负责读取serial using UART1.I find that after calling ad_uart_read a few times, eventually ad_uart_read() will block forever. I am using a USB to TTL adapter, which I can probe using a logic analyzer, so I know that the messages are going out on the wire, but ad_uart_read() still does not return.

By adding prints, I know that ad_uart_read() is blocking on this line:
OS_EVENT_WAIT(device->bus_data->event_read, timeout);

Some details about how I'm configuring the UARTs (UART1 for communication, UART2 for printf)

in main.c:
static const gpio_config gpio_cfg[] = {
HW_GPIO_PINCONFIG(HW_GPIO_PORT_1, HW_GPIO_PIN_3, OUTPUT, UART2_TX, false),
HW_GPIO_PINCONFIG(HW_GPIO_PORT_2, HW_GPIO_PIN_3, INPUT, UART2_RX, false),
HW_GPIO_PINCONFIG(HW_GPIO_PORT_3,HW_GPIO_PIN_2, OUTPUT, UART_TX, false),
HW_GPIO_PINCONFIG(HW_GPIO_PORT_3, HW_GPIO_PIN_3, INPUT, UART_RX, false),
HW_GPIO_PINCONFIG_END
};

..
hw_gpio_configure(gpio_cfg);

in custom_config_qspi.h:

#define CONFIG_RETARGET
#define CONFIG_RETARGET_UART HW_UART2

#define dg_configUART_ADAPTER (1)

//#define dg_configUART_SOFTWARE_FIFO (1)
#define dg_configUART_RX_CIRCULAR_DMA (1)

#define dg_configUART1_RX_CIRCULAR_DMA_BUF_SIZE (100)
//#define dg_configUART1_SOFTWARE_FIFO_SIZE (100)

Note that I've tried switching between using software FIFO and DMA and I get the same behaviour either way.

in platform_device.h:
UART_BUS(UART1, SERIAL1, HW_UART_BAUDRATE_19200, HW_UART_DATABITS_8, HW_UART_PARITY_NONE,
HW_UART_STOPBITS_1, 1, 1, HW_DMA_CHANNEL_1, HW_DMA_CHANNEL_0, 0, 0)

UART_BUS(UART2, SERIAL2, HW_UART_BAUDRATE_115200, HW_UART_DATABITS_8, HW_UART_PARITY_NONE,
HW_UART_STOPBITS_1, 0, 1, HW_DMA_CHANNEL_3, HW_DMA_CHANNEL_2, 0, 0)

in mytask.c:

ad_uart_init();

uart_device uart = ad_uart_open(SERIAL1);

for (;;) {
int len = ad_uart_read()
...
}

Device: 
2018年6月1日星期五14:54:38 +0000 ainwood87 190317年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/uart-read-fails-after-few-attempts#comments