Mbed-os: FPGA shield uart test

Created on 21 Aug 2019  路  7Comments  路  Source: ARMmbed/mbed-os

Description

The FPGA uart test case "9600, 8O1, FC on" enables the odd parity and then checks if data sent by tester is received correctly by DUT uart. This test passes for K64F however it is failing for Ublox C030 targets.
The C030 boards use STM32F4 as MCU and according to the reference manual of this MCU, when parity is enabled, the MSB of value read from Data Register includes the parity bit. So in case of this MCU, the test case should mask the value read with 0xFF before doing the comparison.

Please consider this example:
Tester wrote 0x04 on uart.
Value read from DR is 0x04, the comparison succeeds because in this case the parity bit is set to 0 as parity of data byte is already odd.

Now the written value is incremented:
Tester writes 0x05.
Value read from DR is 0x105, the test asserts here as 0x05 != 0x105 however this is happening because the value in DR includes the parity bit which is now set to 1 as parity of data byte is not odd.

I would also like to know if this behavior is observed for any other targets with ST MCU. I tried on Nucleo-F429ZI but it seems the Arduino header does not have CTS/RTS pins so this test passes with following message:
[1566299117.84][CONN][RXD] Could not find pins for UART testing

@RobMeades @MarceloSalazar @fahim-ublox @c1728p9

Issue request type


[ ] Question
[ ] Enhancement
[X] Bug

CLOSED st mirrored bug

All 7 comments

FYI @jamesbeyond

cc @ARMmbed/mbed-os-hal

@wajahat-ublox Thanks for a detailed description. :+1:

Looking at the ST HAL and the Table 146. of STM32F42xxx RM, I can see that the influence of the PCE bit on the actual number of data bits has been taken into consideration in serial_format() implementation:

https://github.com/ARMmbed/mbed-os/blob/590ce2c958dfcf25759d4eebe2405ce824c2cf2f/targets/TARGET_STM/serial_api.c#L426-L455

but serial_getc() seems to be missing this logic:

https://github.com/ARMmbed/mbed-os/blob/590ce2c958dfcf25759d4eebe2405ce824c2cf2f/targets/TARGET_STM/TARGET_STM32F4/serial_device.c#L271-L275

@LMESTM, @jeromecoutant, it seems we should update the serial_getc() implementation to make use of obj_s->databits for the bitmask calculation. Could you comment on that, please?

@fkjagodzinski Yes i think both obj_s->databits and obj_s->parity need to be used to get the bitmask. obj_s->databits alone will only give total bit length (7, 8 or 9) and without knowing if parity is enabled or not we will not get the correct mask.

@LMESTM, @jeromecoutant, it seems we should update the serial_getc() implementation to make use of obj_s->databits for the bitmask calculation. Could you comment on that, please?

cc @ARMmbed/team-st-mcd

Please check #12611
Thx

Was this page helpful?
0 / 5 - 0 ratings