Altera_Forum
Honored Contributor
20 years agoUart RF Link?
Hi Guys,
I have an interesting problem that I have come across :S I think its either a problem with my code or a problem with the implementation of the Uart in Nios II. I'm trying to implement a data link from a UAV (remote controlled plane basically) and a ground computer. We are using an RF modem to transmit the Uart link from the plane to the ground. The hardware used is the hac-um96 ultra low powerdata radio module (http://www.sparkfun.com/datasheets/rf/hac-um96_manual.pdf) set to transmit and recieve on the same channel with RS-232 and no parity (8N1). Hooked up two computers using this device via hyperterminal and works a charm, press any key on one computer at any time and it gets transmitted straight away to the other. The problem comes when i use the Nios II Core with the Uart via a max-232 chip on a cyclone FPGA. While delay in the following code is less then 10000 all printf get through to the other end of the RF link (PC Nios terminal or hyperterminal). At a delay of 20000; 1 in 5 get through, 30000; 1 in 3, 40000; 1 in 7, 50000; 1 in 2, 100000; 1 in 9. All of these various delays work fine with a straight rs-232 cable link to the computer its only the RF link that misbehaves. Is there any reason you can think of that this would be happening?? Thanks Chrisint main()
{
unsigned int i;
unsigned int j;
unsigned int count;
/* make sure no IRQ enabled */
IOWR(UART_0_BASE, 3, 0x00);
/* flush any characters sitting in the Rx holding register */
i = IORD(UART_0_BASE, 0);
i = IORD(UART_0_BASE, 0);
count=0;
for (;;) {
printf("Hello World! %i\n",count);
count++;
j=0;
while (j<delay)
j++;
//}
}
return 0;
}