Perform "parity check" on Portenta H7

Hi, I am looking for a way to get information about parity errors during serial communication on a Portenta H7.

Please let me know if you know anything about this.

you can look at ST's doc

The hardware UART module handles the parity bit checking internally based on the port configuration, and if a parity error occurs during reception, it sets a status flag that can checked.

in Mbed OS, The BufferedSerial Class' API does not offer direct access to the parity bit for error checking so you would have to dig into the hardware abstraction layer (aka HAL) for the UART

and see what can be done there

Thanks for the reply.

My Portenta H7 Mcu is STM32H74XIH6, so I would need to use stm32h7xx_hal_uart.h.

https://github.com/stm32duino/Arduino_Core_STM32/blob/9f2eaebf63574e27afc7d6363043d94cc073fbfa/system/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_uart.h

/** @defgroup UART_Error_Definition   UART Error Definition
  * @{
  */
#define  HAL_UART_ERROR_NONE             (0x00000000U)    /*!< No error                */
#define  HAL_UART_ERROR_PE               (0x00000001U)    /*!< Parity error            */
#define  HAL_UART_ERROR_NE               (0x00000002U)    /*!< Noise error             */
#define  HAL_UART_ERROR_FE               (0x00000004U)    /*!< Frame error             */
#define  HAL_UART_ERROR_ORE              (0x00000008U)    /*!< Overrun error           */
#define  HAL_UART_ERROR_DMA              (0x00000010U)    /*!< DMA transfer error      */
#define  HAL_UART_ERROR_RTO              (0x00000020U)    /*!< Receiver Timeout error  */


#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
#define  HAL_UART_ERROR_INVALID_CALLBACK (0x00000040U)    /*!< Invalid Callback error  */
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */

I think the actual thoughts about the communications status register are ignoring the fact that the start bit of the next incoming character will reset the USART status byte. So if you want the status of your current byte, you had better save it before you read the received byte,

Thanks for the reply, Paul_KD7HB.

Without your advice, I would have spent more time researching there.