Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

communicate uart with VB

sorry, my english is poor.

I transmit a wavfile to Nios II within MSCOMM32.OCX

baud rate=115200 bps

data bit=8

parity bit=none

stop bit=1

RECEIVER in Nios II IDE

  alt_16 buf;
  for(i=0;i<160;i++){
      fread(&buf, sizeof(alt_16), 1, uart);    //read data from file
      
      if(buf==0x4F4B) break;    //"OK"
      
      IOWR(USER_RAM_BASE, i, buf);    //write data to RAM and play sound
  }

My transmitter transmit data to receiver, but receiver get only incomplete data.

eg. I transmit 0x2353, 0x6411, 0x4235, receiver get only 0x2353, 0x6435, etc.

I guess that transmit speed too fast and transmit buffer too small.

But I can&#39;t how to solve it.

thx

Orz

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    if the uart buffer is overloaded then data will get lost.

    you should implement some handsahe between reciver and transmitter

    the buffer i&#39;m using is 64bytes so the transmiter will not send more then 64 bytes until the reciver didn&#39;t signal that it can read more bytes