This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI Packet

I want to use ATMEGA 328 to send a packet over to the chip as follows:

SPDR = packet ;

Can some one kindly post what the content of this packat should be ? is it possible to transfer a 32 Byte packet in this way to the BLE chip ?

Thanks in advance for you support. Any sample application code for this would be much appriciated.

Parents
  • I think I have figured out the send packet:

    COMMAND PART:

    For example you want to read Temp: (this works in every mode)

    The SPI transmission should consist of 2 bytes: Lenght and Command.

    SS Pulled low. Wait for handshake : RDYN gets pulled low. SPDR = 0X01; wait for transmission to complet. SPDC = 0X0C; wait for transmission to complete.

    SS Pulled up. RDYN goes back up. Transmission complete.

    EVENT PART (Response from the nRF8001):

    RDNY gets pulled low, trigger interrupt and pully SS low. Then start sending some kind of dummy bits (dont know what this should be) to the nRF8001 to get the SPI transmission from the nRF:

    The resulting read on the SPDR after every dummy transmit should look as follows:

    Byte 0: Debug Byte (dont know what this is) Byte 1: 0X04 (legnth of packet in numer of bytes (excluding this byte) and byte 0) Byte 2: 0X84 (Event Type : command response) Byte 3: 0x0C (Temp Read command) Byte 4: 0x00 (success status) Byte 5: 0X0A ( value to be div by 4, i.e. this reads 2.5°C)

    As you can see there are still some gaps in my unerstanding of the "Event" part of the communication. May be there is some expert out there who has figured this out much better than me.

    Regards

  • When I start up SPI communication with the nrf8001, I get the following event:

    0X81 0X40 0X00 0X40

    I am wondering if some one knows what 0x40 codes for ?

    Could not find it in the data sheet ?

Reply Children
No Data
Related