#4719 closed defect (fixed)

risc-v fe310 console driver uart read error

Reported by: Alan Cudmore Owned by: Alan Cudmore <alan.cudmore@…>
Priority: normal Milestone:
Component: bsps Version: 6
Severity: normal Keywords: risc-v, uart
Cc: Blocked By:
Blocking:

Description

In the riscv/riscv fe310_uart_read function, the uart RX data/status register is read twice when reading a character: once for the status, then a second time when reading the data. Reading the RX data/status register twice discards the input data from the first read.

It can be fixed by first reading the RX data/status register into a local variable.

This was verified on a Kendryte K210 CPU which uses the same SiFive? UART. I will submit a patch to fix it.

Change History (1)

comment:1 Changed on 09/19/22 at 15:00:54 by Alan Cudmore <alan.cudmore@…>

Owner: set to Alan Cudmore <alan.cudmore@…>
Resolution: fixed
Status: newclosed

In 88f4d44f/rtems:

bsps/riscv/riscv: Fix fe310_uart_read

Note: Resending after learning how to use git send-email, please disregard previous message.

This fixes the riscv fe310 console driver fe310_uart_read function. The function
reads the RX status/data register to check if data is available, but discards
the data and reads it a seconds time.
Also cleared the interrupt enable bit in the first_open function.

Close #4719

Note: See TracTickets for help on using tickets.