Hello. I am currently using the SC16IS752 and I am obtaining some wrong data bytes. (I also used in the SC16IS762) but I'm obtaining the same results.
My current setup is sending 140 bytes of data at a rate of 40 Hz per second to the uart rx port at a default baud rate of 115200. I am using the orin spi to connect to the ic with a code in c language.
Im my code I am configuring the registers that are needed to enable the fifo and defining the baud rate. After this in order to receive the data I am accessing the register that tells me if there is any data currently on the fifo, reading the line status registor to see if there are any error and then reading the data from the fifo. This reading cycle is then continuously repeated.
Since I am sending a large amount of data the fifo can't be filled otherwise I will lose data. So: If there is data on fifo I read that data. If there is no data I keep scanning for more data. When I read the data the fifo buffer gets cleared (I got this from testing) so I don't need to manual clean it before reading again from it.
Now here is the problem: When reading the data sometimes the data gets lost or gets doubled or tripled or something else.. For example a segment of the data:
Correct message:
$VNIN$0032.0003
Message obtained:
$VN$$$003..000
When reading the data I have tried to implement a delay between readings and I have seen depending on the delay it can somewhat help or not...
I have tried several things but I can't seem to figure this out...
If some additional data is needed please ask me!
Solved! Go to Solution.
I implemented the interrupts and even though it seemed to help I was having some errors still, but I figured it out. Turns out it was that I was reading more than the level of bytes that the rx fifo indicated making it that I was losing some data because I was reading some empty positions, and in the second reading, fifo got rid of the data in positions that had data written to it after the rx level that was indicated! Thanks for the help nevertheless
Hello Rafael,
there is a possibility to set trigger levels for the FIFO, perhaps it would be better for your case, so you don't have to scan the FIFO for data. Please refer to the section 7.1. in the SC16IS752 datasheet.
With Best Regards,
Jozef
Yes, thank you for the reply Jozef! I will try this method today and update you as soon as I get the results.
Hello Rafael,
you welcome. Sure, let me know the results. Have a nice day.
With Best Regards,
Jozef
I implemented the interrupts and even though it seemed to help I was having some errors still, but I figured it out. Turns out it was that I was reading more than the level of bytes that the rx fifo indicated making it that I was losing some data because I was reading some empty positions, and in the second reading, fifo got rid of the data in positions that had data written to it after the rx level that was indicated! Thanks for the help nevertheless