??? 06/16/09 05:12 Read: times |
#166108 - Please help? Responding to: ???'s previous message |
Hello again. I find myself stuck again and I hope someone more experienced with SPI can point me in the right direction.
As I am more familiar with the Analog Devices 8051 derivative (http://www.keil.com/dd/docs/datashts/adi/aduc831_ds.pdf), I went back to basics and wrote new code to request the SPI data from the compass that makes use of the SPI interrupt for receiving data sent from the compass. The uC is an SPI slave and I simply pull the CS (chip select) pin on the compass module low to start SPI comms. The compass then sends out the clock stream as well as an 's' and looks for an 'h' from the uC before sending the current heading out. If it doesn't receive the proper command, it sends out an 'e' and halts SPI communication until the next request. I wrote a simple program to echo the data received from the compass via the MOSI line out the UART and through a MAX232 chip so I can read it in HyperTerminal and I am seeing an s and the e from the compass coming in on the MOSI line. Based on that, I would guess it's safe to say that the compass is not receiving the 'h' command it needs to send the heading data. However, I am not sure why. I preload the SPI Tx buffer with the 'h' before pulling CS low so it sends it out right away. I put my scope on the MISO line to verify that data is getting sent out and there is indeed a bit stream getting sent out but it's such a fast pulse, I can't catch the bit streams to verify that it's the correct character. The data coming in on the MOSI line looks to be working fine, as is the chip select but the 'h' just isn't getting to the compass at the proper time and I'm guessing that's my problem. Per my scope, it looks like the compass is driving the MOSI line high and pulling it low like it should as verified by the scope. Nice square edges and the proper voltage swing one would expect. The same can be said for the MISO line that carries the 'h' to the compass. Do you think this is a timing issue or a hardware issue? When is a pullup or pulldown resistor required on an SPI line, if ever? Any other thoughts or suggestions would be great. Thanks in advance, Brian |
Topic | Author | Date |
SiLabs C8051F500 and SPI | 01/01/70 00:00 | |
answered in crosspost at silabs forum | 01/01/70 00:00 | |
Please help? | 01/01/70 00:00 | |
it could be | 01/01/70 00:00 | |
Slave | 01/01/70 00:00 | |
Have you tried ... | 01/01/70 00:00 | |
thank you | 01/01/70 00:00 | |
Juat a thought | 01/01/70 00:00 | |
compass | 01/01/70 00:00 | |
update | 01/01/70 00:00 | |
just for fun/verification![]() | 01/01/70 00:00 |