- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using rs232 uart in nios. I'm using the open and read functions to recive data from the uart. I'm using the serial port monitor in order to send data on rs232 from the computer to the board. The thing is when using the read function I only get the last byte from the string. For example, if sending "abcd" from the serial port the read function will return only "d". Any idea what could be the problem? Thanks, MerabiLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess this is due to the fact the uart is unbuffered, then you must read the incoming data faster than it arrives
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see..that was my guess too, just wanted to see if anyone ever ran into that too.
When adding the UART in the sopc I can assign to it an IRQ..Do you know if that will cause an interrupt every time a new byte will be recieved in the UART? (of course I will have to make sure that the reading process will be faster than the baud rate)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I see..that was my guess too, just wanted to see if anyone ever ran into that too. When adding the UART in the sopc I can assign to it an IRQ..Do you know if that will cause an interrupt every time a new byte will be recieved in the UART? (of course I will have to make sure that the reading process will be faster than the baud rate) --- Quote End --- Unless you're turning off interrupt handling (masking them) for long periods or you have Interrupt Service Routines taking longer than a few microseconds, there's no chance of not keeping up with 115200 baud even when using interrupts on unbuffered UARTs. However, buffered UARTs are MUCH more efficient because you can make them low priority interrupts and run faster than 115200. For the safest approach unless you absolutely need the serial speed, run somewhere slower like 38400 or 19200. BillA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Unless you're turning off interrupt handling (masking them) for long periods or you have Interrupt Service Routines taking longer than a few microseconds, there's no chance of not keeping up with 115200 baud even when using interrupts on unbuffered UARTs. However, buffered UARTs are MUCH more efficient because you can make them low priority interrupts and run faster than 115200. For the safest approach unless you absolutely need the serial speed, run somewhere slower like 38400 or 19200. BillA --- Quote End --- Hi, Thanks! Actually i'm not doing anything for now but receiving bytes imfrom the uart. I'm working with 19200 baud rate. The thing is that the interrupt mode not seems to work. I'm still receivig only the last byte from each string. I unchecked the small c library and the reduced driver and still not able to recieve all the characters. Any idea why is that happening?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page