Re: STM32F4 serial driver misses sometimes one or morecharac
Posted: Mon Nov 23, 2015 5:04 pm
Hi Giovanni,
I still have problems that the serial driver has a overrunning uart. My current setup:
* Receiver thread which waits for a CHN_INPUT_AVAILABLE event and has HIGHPRIO
* UART set at IRQ priority 2
* UART baudrate at 921600
* Some other threads with lower priority
I also tried by adding a "new" event ID to see if the serial driver buffer was overflowing or the UART register.
Which still resulted in the lowlevel UART register overflow, even with the thread at high priority and using the
event subsystem.
I also looked at direct UART access with DMA, and I have no clue if this will solve the issue.
viewtopic.php?f=16&t=2998
Receiver thread:
I still have problems that the serial driver has a overrunning uart. My current setup:
* Receiver thread which waits for a CHN_INPUT_AVAILABLE event and has HIGHPRIO
* UART set at IRQ priority 2
* UART baudrate at 921600
* Some other threads with lower priority
I also tried by adding a "new" event ID to see if the serial driver buffer was overflowing or the UART register.
Which still resulted in the lowlevel UART register overflow, even with the thread at high priority and using the
event subsystem.
I also looked at direct UART access with DMA, and I have no clue if this will solve the issue.
viewtopic.php?f=16&t=2998
Receiver thread:
Code: Select all
/* Callback run from di_drv_hl854x_read */
static size_t modem_sd_read(void *buf, size_t nbyte)
{
return sdReadTimeout(&DNCM_MODEM_DEV, buf, nbyte, TIME_IMMEDIATE);
}
static THD_WORKING_AREA(modem_recv_wa, 256);
static THD_FUNCTION(modem_recv_thd, arg)
{
(void)arg;
chRegSetThreadName("modem_reader");
eventmask_t e;
eventflags_t flags;
event_listener_t l;
chEvtRegisterMaskWithFlags(chnGetEventSource(&DNCM_MODEM_DEV),
&l,
EVENT_MASK(1),
CHN_INPUT_AVAILABLE | SD_OVERRUN_ERROR);
while (1) {
e = chEvtWaitAny(EVENT_MASK(1));
if (e & EVENT_MASK(1)) {
flags = chEvtGetAndClearFlags(&l);
if (flags & SD_OVERRUN_ERROR) {
chSysHalt("SD#OE");
}
if (flags & CHN_INPUT_AVAILABLE)
di_drv_hl854x_read(&ctx);
}
}
}
...
chThdCreateStatic(modem_recv_wa, sizeof(modem_recv_wa), HIGHPRIO, modem_recv_thd, NULL);
...