If you are using a XMOS board with FTDI chip it will enumerate a COM port on your OS. That can be reached from everything from putty.exe to Phyton with serial lib.
I havn't tried scanf, but I reached 2Mbit transfer rate at 400 MHz XCORE, and 3 Mbit @ 384 MHz XCORE using the XMOS port timers talking UART.
(384MHz/4/16*/2)= 3 Mbit which fits with the 6 MHz clock that the FTDI chip is running.
(400MHz/4/25*/2)= 2 Mbit which fits with the 6 MHz clock that the FTDI chip is running.
16* and 25* is the clockdividers for the ports.
The trick is that the bit-rate must fit the rate of the FTDI chip to work, going fast.
This is an example of a fast transmitter.
Code: Select all
void txByte(int bytes[], unsigned size) {
int byte;
set_clock_div(clk, CLOCKDIV);
configure_out_port(TXD, clk, 1);
start_clock(clk);
#pragma unsafe arrays
for (unsigned i = 0; i < size; i++) {
TXD <: 0; //start bit
byte=bytes[i];
#pragma loop unroll
for(int k=0;k<8;k++)
TXD <: >> byte;
TXD<: 1; //stop bit
}
}