In the past couple months I've one of the things I've been working on is controlling nrf24l01 modules. Communication with the modules is via SPI, and debugging was somewhat tedious as it involved modifying code on the AVR, downloading the code, and observing the results output via serial UART.
While writing the picoboot module for avrdude, I noticed avrdude has a terminal mode which allows for commands to be sent to an AVR. The serial programming interface for AVR MCUs uses SPI, similar to the nrf modules. I realized instead of an AVR, the programmer could be attached to any device that communicates via SPI. A couple hours later I had finished writing aspspi for avrdude - which permits a USBasp to be used for interactive SPI communication.
Avrdude requires an avr part (-p), which is not applicable to aspspi, so just use any part listed in avrdude.conf. The -F argument is to ignore signature checking (since there isn't an avr attached), -u turns off safe mode, and -t enters terminal mode.
In the screen shot above "send 3 0 0 0" sends the command to read register 3 on the nrf. The response is the status (0e) and the contents of register 3 (03) repeated 3 times. Sending 0x23 is the command to write to register 3. As a single-byte register the first 2 zeros are ignored, and the last byte (1) is what gets written to the nrf.
With aspspi I was able to interactively test nrf modules, and I even found an undocumented register 0x1e, which contains at least 3 bytes: 68 66 05.
The code for aspspi is in the picoboot-avrdude repository.
Great work as always.. by the way, I would like to build a bluetooth LE with nrf24l01+ controlled by a ATtiny85, is it possible to work? It will be a pretty cool article if your write about it.
ReplyDeleteIt's been tried, and given the packet size limitations, you can't do a full BLE stack.
DeleteThis comment has been removed by the author.
ReplyDelete