Altera_Forum
Honored Contributor
9 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)
{
alt_u32 j,len;
j=strlen(char1);
alt_printf("Beginning transfer \n ");
for (len =0 ; len <j; len++){
IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE,char1);
alt_printf("Sending : %c ",IORD_ALTERA_AVALON_UART_TXDATA(UART_BASE));//Character sent
}
}
void uart_receive_data(void){alt_u16 j=0,len=0,i=0 ;
volatile alt_8 temp;
status = IORD_ALTERA_AVALON_UART_STATUS(UART_BASE);
while ( ( status & 0x0080)){
temp= IORD_ALTERA_AVALON_UART_RXDATA(UART_BASE);
Mem=temp;
j++;
} // waiting for data
len=strlen(Mem);
for (i=0;i<len;len++){
alt_printf("REP%c",Mem);
}
} this functions aren't working well I don't know if it is because the ESP8266 or I made smth wrong. Please guys can you tell me if my program is okay. TKHS