by TazzI » Tue Jul 22, 2014 12:12 am
1 step forward, 2 steps back.
Soooo I can read the SPI commands... buuuuutttt I dont know how to inject them back in! haha. Im unsure if my examples on the arduino are failing because the message isnt formatted correctly or if its because the bus is being halted by the arduinos presence.. or if the Hz speed is too high!
The radio communicates on really low speed, well.. thats what I found using the bus pirate.. all the higher speeds produced rubbish data. On the arduino Mega, at its 16Mhz frequency.. the slowest I can get it is 16/128 = 128Khz, which is still too fast (1 think). I originally attempted reading the MISO/MOSI at 1Mhz.. which really gave out odd/useless data that meant nothing.
Well.. might need to use something with a lower frequency. Or exchange the 16mhz for a 4mhz one..
Or, I can hook the buspirate onto the SPI at the same time and see what the arduino is sending.. which is probably the smartest option there.
*Random Jibber Jabber*
MISO = Master In Slave Out = Slave sends data to Master
MOSI = Master Out Slave In = Master sends data to Slave
Both of these actions occur at the same time (kinda). MOSI sends out data, then MISO will send back data and this will contirnue to occur until CS is pulled high again and communication has haulted.
So MOSI is where the micro sends info to the LCD
ANd MISO is where the LCD sends info to the Micro (I think?! or have I got that the wrong way round?)
So by the above logic, if I send data over MISO, it would only be directed at the mirocontroller and the LCD wouldnt see it, but MISO is the line that had the "useful" command lines as seen with Nems examples, but then why would the LCD be sending commands and the micro acknowledgeing them.. shouldnt it be the other way round? . So.. does that mean I need to send those commands over MOSI, will the LCD interpret the correctly??
This then brings me back to the original issue, that as soon as a "master" is introduced to the system (Send over MOSI), this causes the comms to stop. Meaning, I need to set the arduino as a "slave", then inspect the comms until it is pulled low.. swap arduino to master, sends frames over MOSI, then swap back over to slave. But then if Im waiting for comms to be pulled low, this means that the micro is sending info at the same time?
Ahhhhhhhh... so confused!!! This then means I need to be disable the micro so that I can pull CS low whenever needed, pull CS high then re-enable the micro. ANd even then, I have to disable the SPI pins again to prevent the comms from freezing up again (which Im still unsure why this is happening).
*Plan of action*
-Tinker a little more with trying to send data to LCD using buspirate.. might get lucky
-Work out who is slave and who is master! Simple question but im now confused!
-Possible (midi) interface between lcd board and mother board. Arduino intercepts commands from each direction and injects its own.. will need a software SPI setup so that two spi systems can run together.
And finally, try reading MISO and MOSI on arduino to see if selected baud rate picks up correct frames.