RandoSY / perfect-pic-plaground

Automatically exported from code.google.com/p/perfect-pic-plaground
0 stars 0 forks source link

18F2550 won't correctly return multiple bytes in slave read mode. #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
All files to reproduce this are available in the motor controller folder.
What steps will reproduce the problem?
1. Supply a write command to 0x10 containing two bytes
2. Supply a read command to 0x11(read address of 0x10) and read two bytes

What is the expected output? What do you see instead?
You should see the initial two bytes read back, however the pic will often only 
return the first byte correctly, and the second byte will usually be 
right-shifted by 1.

I suspected this to be a timing issue, so I added a delay after filling the 
SSPBUF from the array. It made no difference how long or short the delay was, 
the problem still occurred with more or less the same frequency. 

When inspected with the logic analyzer, it appears that the data being returned 
from the pic is in fact correct, but the bus pirate reads the data differently 
depending on if the last byte was ACKed or NACKed. 

Attached are two logic analyzer traces of the communication. When the bus 
pirate reads the correct values, it is always when a NACK is returned, 
otherwise it reads the incorrect values.

Original issue reported on code.google.com by m.kapusc...@gmail.com on 13 Jan 2012 at 7:36

Attachments: