Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UART Core using add_uart in soc.py, Rare Transmission Error on first byte of sequence #2049

Open
Haron123 opened this issue Aug 24, 2024 · 0 comments

Comments

@Haron123
Copy link

Hello

How i found the Issue

Target File (Snippet)

# Uart
self.add_uart("serial0", "uart0", baudrate=9600)

C++ Driver (Snippet)

UserSerial::UserSerial()
{
	serial0_ev_pending_write(serial0_ev_pending_read());
	serial0_ev_enable_write(UART_EV_TX | UART_EV_RX);
}

void UserSerial::write(uint8_t byte)
{
	/* Wait for UART tx buffer to be free */
	while(serial0_txfull_read());
	serial0_rxtx_write(byte);
	serial0_ev_pending_write(UART_EV_TX);
}

Test Code (Snippet)

serial.write('0');
serial.write('0');
serial.write('0');

Expected Result

"000" on the Serial Console, 0x30, 0x30, 0x30 on Logic Analyzer

Actual Result

"00" on the Serial Console, 0x00, 0x30, 0x30 on Logic Analyzer

Screenshot_2024-08-24_16-48-29

When does it Occur

It seems to occur on the first Byte after restarting the SoC, sometimes i get the issue even after slight Delays. It is as far as i saw always the first Byte of a sequence which gets turned to 0x00.

What did i try to fix it

i tried to use add_auto_tx_flush to the uart, though that gave me errors with Yosys. Incase someone has an example usage of this and thinks it might fix it, id love if you can share it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant