Other Parts Discussed in Thread: CC2540
I'm trying to implement HCI over SPI on the CC2540, and as a first step, I'm trying just to get basic commands sent over SPI and interpreted by the CC2540 as a SPI Slave.
I followed the instructions at this wiki (
) and have integrated the SerialInterface API into the SimpleBLEPeripheral workspace. Seems like everything builds and downloads with no issues. I think I've reverse engineered the desired packet structure from the SerialInterface.c source, but I'm still not seeing any feedback from the CC2540 that the commands are being seen. I have a bus pirate acting as SPI Master and connected the the P18 debug header on my v1.8.8 SmartRF05 board, connected as follows:
MISO - Pin 12
MOSI - Pin 18
CS - Pin 14
CLK - Pin 16
GND - Pin 20
As far as I can tell from the source, cSerialPacketParser() is registered as a callback for NPI Transport when the Serial Interface task is first initialized. From here, cSerialPacketParser steps through the incoming data, looking for a) the cmd_identifier of 0x77, b) the op_code (0x1, 0x2, or 0x3), c) the cmd_len, and d) the cmd_data. For example, if I wanted to enable advertising, I would send 0x77,0x01,0x04,[duration, interval]. Or if I wanted to print something to the RF05 LCD, I would send 0x77,0x03,0x03,0x41,0x42,0x43 (I would expect this to print 'ABC' on the display).
However, I get no reaction (not even a failure response) from the CC2540.
Additionally, I have no idea how the actual SPI parsing code ever gets invoked. spiParseRx() is what parses the incoming data against the desired SPI packet format: 0xFE (Start of Frame), (Data Length), (data), (frame-sequence-check). This code is called in the chain from HalUARTPoll, but I couldn't find any place inside the source that that function gets invoked!
So I have no idea if my cSerialPacketParser byte arrays need to be the data portion of a normal SPI packet or not, and I have no idea where along the lines my SPI communication is failing.
Has anyone else used the SerialInterface patch with SPI?
