TXT I2C speed test with my "super Kugelbahn"
Verfasst: 19 Apr 2018, 17:33
I use a TXT controller to control my "super Kugelbahn" and to show the flow on my 32 inch UHD screen. Connection between TXT en FPGA board is done via the I2C line. This allows me to follow the trajectory of the bullet on the big screen and to return commands. Although I work with an FPGA it doesn't really matter what you use, this can also be your preferred hardware.
Because I had to develop an I2C slave driver myself, it was necessary to learn how to use and study the I2C protocol. I have examined whether you could optimize the speed of data processing. An advantage of the FPGA is that it can work very quickly, so you have plenty of time to process the data without extra delays. As data I need about 16 bytes of info from the FPGA. My first question was whether you could do a burst read. Of course I first tried an normal read and write operation. After writing the basic I2C slave, everything worked very nicely. Reading or writing a byte was perfect. The FPGA can optimize the timing, I use oversampling with a 20 MHz clock. This allows me to trim the timing in steps of 50 nsec.
The next step was a burst read. The TXT controller allows this possibility. If you only read or write one byte, there is always a considerable interval. This interval is longer than the reading itself. With a burst access there is no interval and you can use the full I2C speed.
A few pictures:
Links on bigger pictures:
https://www.flickr.com/photos/fotoopa_hs/41560001241
https://www.flickr.com/photos/fotoopa_hs/27690489348
https://www.flickr.com/photos/fotoopa_hs/26691496487
Oh, that was super, now all the data in real time on the big PC screen. I also need to be able to send commands back, so from the TXT to my own hardware. I don't have much data to send because the control itself is done in the external hardware. They are small commands such as switching servo x to the other position so that the trajectory of the balls is changed. But why not test a 16-byte burst mode first? But here comes a disappointment. Things are going wrong with me, the TXT controller does not send the order of the bytes correctly. Either I make a mistake, that could be the case, but still I think that the TXT is wrong. As long as you write byte per byte everything is done correctly. With a burst, the TXT does not start with the data of the address it is just sending, but with the following data byte. He always places the first missed data at the back of the string. I think this is wrong. I have made many tests with open and close of device but each time with the same result, in the case of a burst the first data is at the back of the string.
Here are a few images:
Links on bigger pictures:
https://www.flickr.com/photos/fotoopa_hs/26691496287
https://www.flickr.com/photos/fotoopa_hs/39751707890
Now I use for writing only byte access and then it works perfectly.
Note that the timings are super good. To read 16 bytes, only 407 usec is required. With the overheat for 7 blocks of 16 bytes the time is only 4.758 msec of 1470 block refresch/sec. Note this timing is when you run it offline. I need online, so there is more overhead. The TXT controller sometimes needs an extra waiting time of 1 to 2 msec to process everything. However, at least all data is processed 250 per second in the online mode.
I use a Win7 Intel I7 system as PC @3.5GHz + SSD disk.
Has anyone experience to get the burst write mode right?
Update:
I have found the reason of the order error. In a burst mode write, all calls except the last one must be open. The last call must contain the desired start address. All other addresses are irrelevant. The only disadvantage is that the symbol address of this last write cmd in your program does not actually correspond to your intended data. But that's how the burst mode work correctly.
Here a link to the new I2C burst write plot:
https://www.flickr.com/photos/fotoopa_hs/40852356934
Here an extra link to the picture of the working super Kugelbahn on the UHD screen:
https://www.flickr.com/photos/fotoopa_hs/40598970634
Frans.
Because I had to develop an I2C slave driver myself, it was necessary to learn how to use and study the I2C protocol. I have examined whether you could optimize the speed of data processing. An advantage of the FPGA is that it can work very quickly, so you have plenty of time to process the data without extra delays. As data I need about 16 bytes of info from the FPGA. My first question was whether you could do a burst read. Of course I first tried an normal read and write operation. After writing the basic I2C slave, everything worked very nicely. Reading or writing a byte was perfect. The FPGA can optimize the timing, I use oversampling with a 20 MHz clock. This allows me to trim the timing in steps of 50 nsec.
The next step was a burst read. The TXT controller allows this possibility. If you only read or write one byte, there is always a considerable interval. This interval is longer than the reading itself. With a burst access there is no interval and you can use the full I2C speed.
A few pictures:
Links on bigger pictures:
https://www.flickr.com/photos/fotoopa_hs/41560001241
https://www.flickr.com/photos/fotoopa_hs/27690489348
https://www.flickr.com/photos/fotoopa_hs/26691496487
Oh, that was super, now all the data in real time on the big PC screen. I also need to be able to send commands back, so from the TXT to my own hardware. I don't have much data to send because the control itself is done in the external hardware. They are small commands such as switching servo x to the other position so that the trajectory of the balls is changed. But why not test a 16-byte burst mode first? But here comes a disappointment. Things are going wrong with me, the TXT controller does not send the order of the bytes correctly. Either I make a mistake, that could be the case, but still I think that the TXT is wrong. As long as you write byte per byte everything is done correctly. With a burst, the TXT does not start with the data of the address it is just sending, but with the following data byte. He always places the first missed data at the back of the string. I think this is wrong. I have made many tests with open and close of device but each time with the same result, in the case of a burst the first data is at the back of the string.
Here are a few images:
Links on bigger pictures:
https://www.flickr.com/photos/fotoopa_hs/26691496287
https://www.flickr.com/photos/fotoopa_hs/39751707890
Now I use for writing only byte access and then it works perfectly.
Note that the timings are super good. To read 16 bytes, only 407 usec is required. With the overheat for 7 blocks of 16 bytes the time is only 4.758 msec of 1470 block refresch/sec. Note this timing is when you run it offline. I need online, so there is more overhead. The TXT controller sometimes needs an extra waiting time of 1 to 2 msec to process everything. However, at least all data is processed 250 per second in the online mode.
I use a Win7 Intel I7 system as PC @3.5GHz + SSD disk.
Has anyone experience to get the burst write mode right?
Update:
I have found the reason of the order error. In a burst mode write, all calls except the last one must be open. The last call must contain the desired start address. All other addresses are irrelevant. The only disadvantage is that the symbol address of this last write cmd in your program does not actually correspond to your intended data. But that's how the burst mode work correctly.
Here a link to the new I2C burst write plot:
https://www.flickr.com/photos/fotoopa_hs/40852356934
Here an extra link to the picture of the working super Kugelbahn on the UHD screen:
https://www.flickr.com/photos/fotoopa_hs/40598970634
Frans.