Hi Guys ,
I am looking at a module NRF24L01+ rf transceiver , which uses interface of SPI .
Since the PIC i am using has no SPI, i have allocated i/o pins to connect it , and using shiftout/ shiftin to get data in/out
this module spec states it requires that the SPI present data , LSBbyte to MSByte , with MSBit in each Byte first
eg command D7 -D0 , LSB databyte d7-d0 , MSB databyte D15-d8
however i am not completely sure what it expects in correct order given the above SPI requirement
example - to configure a RX pipe0 address of 5 bytes ( its expecting 5 bytes) , i would think i would need to do the following in the order 1- 6 shown
Or would i need to process all but the command byte in reverse order given eg 1 , then 6 to 2
i guess the spec sheet has me a bit confused, any input on if i have interpreted this correct ( eg order 1-6) would be good
http://www.nordicsemi.com/eng/Produc...Hz-RF/nRF24L01i have written code to do the following
1. send the command byte = write_reg = $20
2. send the register byte = RX_address_p0 = $0A
3. Send byte 1 = "N" = $4E
4. Send byte 2 = "E" = $45
5 Send byte 3 = "T" = $54
6 send byte 4 = "1" = $01
7 send byte 5 = "4"= $04
Code:Rf_Common_setup: '1. Set Address number of Bytes for all Pipes data_out[0]= Write_reg ' Command data_out(1)= Setup_aw ' Setup Address width all pipes data_out[2]= $03 ' $00: illigal, $01: 3 bytes, $02: 4 bytes,$03: 5bytes num_byte=2 gosub SPI_write '2a. ------ Rx Address for Pipe 0 ------ data_out[0]= Write_reg ' Command data_out(1)= Rx_addr_p0 ' Rx address for pipe0 data_out[2]= $4E ' "N" '5 byte address data_out[3]= $45 ' "E" data_out[4]= $54 ' "T" data_out[5]= $01 ' "1" data_out[6]= $04 ' "4" num_byte=6 gosub SPI_write return SPI_write: SPI_X = 0 ' Ensure SPI_X = 0 CSN = 0 ' Chip enable For SPI_X = 0 to Num_byte ' loop for # byte Shiftout SI, SCK, MSBFIRST, [data_out(SPI_X)] ' Send write enable command next SPI_X CSN = 1 ' Disable to execute command return




Bookmarks