I'm porting my code to chibios 2.5.1 and I'm having issues dealing with Serial driver.
Everything worked perfectly on 2.4.x however this code get serial event errors that never occurred on 2.4.x. I'm trying to debug but I have no success... Event flag on 2.5.x is 736 decimal(tons of event errors). But I didn't receive this on 2.4.x. Note that I'm dealing with a non-trivial serial device: it's 8E2 100000bps. SerialConfig is:
Code: Select all
const SerialConfig sbusPortConfig = {
100000,
(1 << 10),
USART_CR2_STOP2_BITS,
0
};2.5.x not working code:
Code: Select all
static WORKING_AREA(waThreadRadio, 256);
static msg_t ThreadRadio(void *arg) {
(void)arg;
chRegSetThreadName("radio");
EventListener elRadio;
chEvtRegisterMask((EventSource *)chnGetEventSource(&SD1), &elRadio, 1);
while (TRUE) {
flagsmask_t flags;
chEvtWaitOneTimeout(EVENT_MASK(1), MS2ST(10));
flags = chEvtGetAndClearFlags(&elRadio);
if (flags & CHN_INPUT_AVAILABLE) {
char c;
c = chnGetTimeout(&SD1, TIME_IMMEDIATE);
// do my stuff with "c"
}
}
}
2.4.x working properly code:
Code: Select all
static WORKING_AREA(waThreadRadio, 256);
static msg_t ThreadRadio(void *arg) {
(void)arg;
chRegSetThreadName("radio");
EventListener elRadio;
chEvtRegister(chIOGetEventSource(&SD1), &elRadio, 1);
while (TRUE) {
ioflags_t flags;
chEvtWaitOneTimeout(EVENT_MASK(1), MS2ST(10));
flags = chIOGetAndClearFlags(&SD1);
if (flags & IO_INPUT_AVAILABLE) {
char c;
c = chIOGetTimeout(&SD1, TIME_IMMEDIATE);
// do my stuff with "c"
}
}
}Thank you very much.
Wagner