Forum Discussion
Altera_Forum
Honored Contributor
10 years agoNIOS UART and esp 8266
Hi all, I'm trying to make an interface between an FPGA and an esp8266 with the NIOS II UART Core, here you found my transmit and receive functions
void uart_send_data(unsigned char char1)...
Altera_Forum
Honored Contributor
10 years agoHi again,
I changed my C code because it wasn't working good, so far my transmit/receive work's fine, the next step is to get the received message and compare it with a list of responses. but I couldn't do it. any ideas please??# define RRDY 0x80
typedef volatile struct {
char send;
char rece;
int lenS;
int lenR;
}message;
void uart_receive_data(void)
{
int count=0;
message mess;
alt_u8 status;
status= IORD_ALTERA_AVALON_UART_STATUS(UART_BASE);
while((status & RRDY)==RRDY ) // check if reception ready
{
mess.rece=IORD_ALTERA_AVALON_UART_RXDATA(UART_BASE);//receive character
printf("%c",mess.rece); //print the character received
status= IORD_ALTERA_AVALON_UART_STATUS(UART_BASE); //update status register
count++;
}
}