I used ChibiOS 17.6.x and after updating to the latest version I was found that changes in SERIAL drivers is affect to my program.
I have function to send 1 (ONE) byte over serial driver is SPI mode.
Code: Select all
/** ------------------------------------------------------------------------ **
* \brief Setting the given value to potenciometer
* \param[in] value - given value
* ------------------------------------------------------------------------- */
void PGA_Class::set_value(char value) {
// Start the driver
static const SerialConfig pga_serial_cfg = {
4500000,
0,
USART_CR2_MSBFIRST | USART_CR2_CLKEN | USART_CR2_LBCL, // | USART_CR2_CPHA | USART_CR2_CPOL
0
};
sdStart(&PGA_SERIAL_DRIVER, &pga_serial_cfg);
// RX not used
PGA_SERIAL_DRIVER.usart->CR1 &= ~USART_CR1_RE;
// Register event listener to receive USART events
event_listener_t el_sd;
chEvtRegisterMask(chnGetEventSource(&PGA_SERIAL_DRIVER), &el_sd, 128);
// Accert the CS line
palClearPad(cs->port, cs->pin_n);
// write to register
sdPut(&PGA_SERIAL_DRIVER, value);
// wait the end of transmission
for (;;) {
eventmask_t m = chEvtWaitOneTimeout(128, MS2ST(100));
if (m == 0) break;
// event of the UART
eventflags_t flags = chEvtGetAndClearFlags(&el_sd);
if (flags & CHN_TRANSMISSION_END)
break;
}
// Release the CS
palSetPad(cs->port, cs->pin_n);
// Unregiister
chEvtUnregister(chnGetEventSource(&PGA_SERIAL_DRIVER), &el_sd);
// Stop the driver
sdStop(&PGA_SERIAL_DRIVER);
}
When I used before the function was success to wait end of transmission, but now it exit with timeout.
I looking to the change history and found that there was this changes:
What was the need to really change this behavior?