FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6355 Discussions

SPI Slave to Avalon-MM escape problem

DRaineyNAL
Beginner
465 Views

I am using the SPI-Slave to Avalon-MM IP to communicate with a MAX10 FPGA from a host processor (current test is on DE10-Lite board). In general everything is working. I can read and write devices and memory on the bus, with one exception.  When I try to write data that has an IDLE character as the last byte sent, the data is not written correctly.

 

For example, to write the data 4A 00 00 00 to address 00 04 00 00, I produce the following escaped packet which is sent to the SPI port:

Data to Send: 00 00 00 4A
Address and Data: 00 04 00 00 00 00 00 4A
Escaped Address and Data: 00 04 00 00 00 00 00 4A
Full Command Pkt: 7A 7C 00 04 00 00 04 00 04 00 00 00 00 00 7B 4A
Final SPI escaped data sent: 7A 7C 00 04 00 00 04 00 04 00 00 00 00 00 7B 4D 6A

 

When I read this location, the data is 4D 00 00 00, as if the spi slave is ignoring the escape byte and treating the escape (4D) as a normal character. This DOES NOT happen if the 4A is anywhere but in the final byte.  If I leave out the escape character, the 4A is ignored as an IDLE byte. 

What am I doing wrong? Every other data write to this area of memory works perfectly. It is only data values that contain 4A in the last byte sent that are a problem.

 

I'm not sure this is the correct forum for this post, please redirect me if necessary.

0 Kudos
1 Solution
DRaineyNAL
Beginner
459 Views

I actually just resolved this issue. The problem was not in the write packet. The problem was that when I read the value back I was not properly handling the escape at the end of the packet. This problem is resolved.

View solution in original post

0 Kudos
1 Reply
DRaineyNAL
Beginner
460 Views

I actually just resolved this issue. The problem was not in the write packet. The problem was that when I read the value back I was not properly handling the escape at the end of the packet. This problem is resolved.

0 Kudos
Reply