Today we started looking at our 2206Q chips. We ca...
# caravel
j
Today we started looking at our 2206Q chips. We can get the blink example to work, and also see the "Hello world!!" printed on the serial. However, serial receive doesn't seem to work well: we implemented a simple echo. Usually it doesn't echo anything. Sometimes it will echo the character, but will keep on repeating it indefinitely. Any thoughts on fixing this?
static uint8_t serial_send(uint8_t data) {
// Sends one character over the line and returns the status to the caller.
while (uart_txfull_read()); // Block until we have space
reg_uart_data = data;
return STATUS_OK;
}
static uint8_t serial_recv(uint8_t* data) {
// Receives 1 byte and stores it in the data argument. This function must be blocking.
// while (uart_rxempty_read()) {}; // Block until we have a character
uint32_t data32;
do {
data32 = reg_uart_data;
} while (data32 == 0xffffffff);
*data = data32 & 0xff; // Load character
return STATUS_OK;
}
and in main:
print("Hello RISCAsic!\n");
while (1) {
uint8_t recvStatus = serial_recv(&cmd);
serial_send(cmd);
}
maybe @Tim Edwards or @Matt Venn know more? thanks in advance!
Of course posing the problem is close to solving it. I found this:
#define UART_EV_PEND (*(volatile uint32_t*) 0xf0005810)
#define UART_EV_RX  0x2
UART_EV_PEND = UART_EV_RX;
If I put that after my receive code, it works.
t
@Jasper van Woudenberg: Thanks for solving it faster than I could get around to reading the post. : )
m
I found this repo useful in my testing