Github vs XMOS
I never actually modified the provided UART code. My application was just streaming information (like image data) that constantly refreshed. Because I could see when I missed a byte (value is out of range), I just ignored it - perfectly fine for that application. Even 3M baud worked, but was much less stable.
There's a 'fast' uart there now with less functionality than the previous one but which runs up to 10 Mbaud, allegedly.
More details here: https://github.com/xcore/sc_uart/blob/m ... ummary.rst
Do let me know what you think (btw, it wasn't me that that wrote it).
More details here: https://github.com/xcore/sc_uart/blob/m ... ummary.rst
Do let me know what you think (btw, it wasn't me that that wrote it).
I don´t know why there is so bad example and further the need to adverthise the
author and usage of the piece of SW. Sorry for the disagree.
This is a modification , untested, for verify the start bit, normally standard
on software uart implementation.
For lower speed (3mhz and lower) tx and rx can share one thread.
author and usage of the piece of SW. Sorry for the disagree.
This is a modification , untested, for verify the start bit, normally standard
on software uart implementation.
Code: Select all
void uart_rx(in port pIn, streaming chanend cOut, int clocks) {
int dt2 = (clocks * 3)>>1;
int dt = clocks;
int t;
unsigned int data = 0;
while (1) {
data =0;
pIn when pinseq(0) :> int _ @ t;
t += dt2-dt;
pIn @ t :> >> data;
if (!data) continue;
#pragma loop unroll(9)
for(int i = 9; i--; ) {
t += dt;
pIn @ t :> >> data;
}
data >>= 23;
if (data&0x100) continue; /* TODO: framing error
pIn @ t :> int _; * output read data now
*/
cOut <: (unsigned char) data;
}
}