SC16IS752 in SPI mode using fifo. Errors in received FIFO bytes

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SC16IS752 in SPI mode using fifo. Errors in received FIFO bytes

跳至解决方案
1,911 次查看
RM99
Contributor II

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!

 

 

0 项奖励
回复
1 解答
1,836 次查看
RM99
Contributor II

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

在原帖中查看解决方案

4 回复数
1,890 次查看
JozefKozon
NXP TechSupport
NXP TechSupport

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

JozefKozon_0-1705995253493.png

JozefKozon_1-1705995505544.png

 

With Best Regards,

Jozef

0 项奖励
回复
1,862 次查看
RM99
Contributor II

Yes, thank you for the reply Jozef! I will try this method today and update you as soon as I get the results.

0 项奖励
回复
1,848 次查看
JozefKozon
NXP TechSupport
NXP TechSupport

Hello Rafael,

you welcome. Sure, let me know the results. Have a nice day.

With Best Regards,

Jozef

0 项奖励
回复
1,837 次查看
RM99
Contributor II

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