Skip to content

Commit c01392a

Browse files
committed
Cherry picked commits pulled from baruch/nRF24LE1_Programmer
1 parent 42e0067 commit c01392a

File tree

6 files changed

+309
-26
lines changed

6 files changed

+309
-26
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
**/.directory
2+
**/build-*

Read_Infopage/Makefile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# STANDARD ARDUINO WORKFLOW
2+
#
3+
# Given a normal sketch directory, all you need to do is to create
4+
# a small Makefile which defines a few things, and then includes this one.
5+
#
6+
# For example:
7+
#
8+
# ARDUINO_LIBS = Ethernet Ethernet/utility SPI
9+
# BOARD_TAG = uno
10+
# ARDUINO_PORT = /dev/cu.usb*
11+
#
12+
# include /usr/share/arduino/Arduino.mk
13+
#
14+
# Hopefully these will be self-explanatory but in case they're not:
15+
#
16+
# ARDUINO_LIBS - A list of any libraries used by the sketch (we
17+
# assume these are in $(ARDUINO_DIR)/hardware/libraries
18+
# or your sketchbook's libraries directory)
19+
#
20+
# ARDUINO_PORT - The port where the Arduino can be found (only needed
21+
# when uploading)
22+
#
23+
# BOARD_TAG - The ard-parse-boards tag for the board e.g. uno or mega
24+
# 'make show_boards' shows a list
25+
#
26+
# If you have your additional libraries relative to your source, rather
27+
# than in your "sketchbook", also set USER_LIB_PATH, like this example:
28+
#
29+
# USER_LIB_PATH := $(realpath ../../libraries)
30+
#
31+
# If you've added the Arduino-Makefile repository to your git repo as a
32+
# submodule (or other similar arrangement), you might have lines like this
33+
# in your Makefile:
34+
#
35+
# ARDMK_DIR := $(realpath ../../tools/Arduino-Makefile)
36+
# include $(ARDMK_DIR)/arduino-mk/Arduino.mk
37+
#
38+
# In any case, once this file has been created the typical workflow is just
39+
#
40+
# $ make upload
41+
#
42+
# All of the object files are created in the build-{BOARD_TAG} subdirectory
43+
# All sources should be in the current directory and can include:
44+
# - at most one .pde or .ino file which will be treated as C++ after
45+
# the standard Arduino header and footer have been affixed.
46+
# - any number of .c, .cpp, .s and .h files
47+
#
48+
# Included libraries are built in the build-{BOARD_TAG}/libs subdirectory.
49+
#
50+
# Besides make upload you can also
51+
# make - no upload
52+
# make clean - remove all our dependencies
53+
# make depends - update dependencies
54+
# make reset - reset the Arduino by tickling DTR on the serial port
55+
# make raw_upload - upload without first resetting
56+
# make show_boards - list all the boards defined in boards.txt
57+
# make monitor - connect to the Arduino's serial port
58+
# make size - show the size of the compiled output (relative to
59+
# resources, if you have a patched avr-size)
60+
# make disasm - generate a .lss file in build-cli that contains
61+
# disassembly of the compiled file interspersed
62+
# with your original source code.
63+
# make verify_size - Verify that the size of the final file is less than
64+
# the capacity of the micro controller.
65+
# make eeprom - upload the eep file
66+
# make raw_eeprom - upload the eep file without first resetting
67+
#
68+
########################################################################
69+
#
70+
# SERIAL MONITOR
71+
#
72+
# The serial monitor just invokes the GNU screen program with suitable
73+
# options. For more information see screen (1) and search for
74+
# 'character special device'.
75+
#
76+
# The really useful thing to know is that ^A-k gets you out!
77+
#
78+
# The fairly useful thing to know is that you can bind another key to
79+
# escape too, by creating $HOME{.screenrc} containing e.g.
80+
#
81+
# bindkey ^C kill
82+
#
83+
# If you want to change the baudrate, just set MONITOR_BAUDRATE. If you
84+
# don't set it, it tries to read from the sketch. If it couldn't read
85+
# from the sketch, then it defaults to 9600 baud.
86+
#
87+
########################################################################
88+
89+
ARDUINO_LIBS = SPI SoftwareSerial
90+
BOARD_TAG = uno
91+
ARDUINO_PORT = /dev/ttyACM*
92+
include /usr/share/arduino/Arduino.mk

Read_Infopage/Read_Infopage.ino

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
/*
22
Read_Infopage
3-
3+
44
Reads InfoPage contents from Nordic nRF24LE1 SOC RF chips using SPI interface from an Arduino.
55
Useful for making a backup of the system variables stored in the InfoPage.
6-
6+
77
Upload sketch, start serial monitor, type 'GO' to start sketch running.
8-
8+
99
Copyright (c) 2014 Dean Cording
10-
10+
1111
Permission is hereby granted, free of charge, to any person obtaining a copy
1212
of this software and associated documentation files (the "Software"), to deal
1313
in the Software without restriction, including without limitation the rights
1414
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1515
copies of the Software, and to permit persons to whom the Software is
1616
furnished to do so, subject to the following conditions:
17-
17+
1818
The above copyright notice and this permission notice shall be included in
1919
all copies or substantial portions of the Software.
20-
20+
2121
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2222
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2323
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2424
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2525
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2626
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2727
THE SOFTWARE.
28-
28+
2929
*/
3030

3131
/*
@@ -96,7 +96,7 @@
9696
#define RDISMB 0x85 // Enable flash readback protection
9797
#define ENDEBUG 0x86 // Enable HW debug features
9898

99-
/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters.
99+
/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters.
100100
* Erasing the content of this area WILL cause changes to device behavior and performance. InfoPage area
101101
* DSYS should ALWAYS be read out and stored prior to using ERASE ALL. Upon completion of the
102102
* erase the DSYS information must be written back to the flash InfoPage.
@@ -132,15 +132,18 @@ void setup() {
132132

133133
Serial.println("READY");
134134
// Wait for GO command from Serial
135-
//while (!Serial.find("GO\n"));
135+
while (!Serial.find("GO\n"));
136+
Serial.println("READYING");
137+
delay(1000);
138+
Serial.println("SETTING UP");
136139

137140
// Put nRF24LE1 into programming mode
138141
digitalWrite(PROG, HIGH);
139142
digitalWrite(_RESET_, LOW);
140143
delay(10);
141144
digitalWrite(_RESET_, HIGH);
142145

143-
// Set InfoPage bit so InfoPage flash is read
146+
// Set InfoPage bit so InfoPage flash is read
144147
digitalWrite(_FCSN_, LOW);
145148
SPI.transfer(RDSR);
146149
fsr = SPI.transfer(0x00);
@@ -178,7 +181,7 @@ void setup() {
178181
Serial.print(": ");
179182
Serial.println(spi_data);
180183
}
181-
digitalWrite(_FCSN_, HIGH);
184+
digitalWrite(_FCSN_, HIGH);
182185

183186
done:
184187
Serial.println("DONE");

Read_Mainpage/Makefile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# STANDARD ARDUINO WORKFLOW
2+
#
3+
# Given a normal sketch directory, all you need to do is to create
4+
# a small Makefile which defines a few things, and then includes this one.
5+
#
6+
# For example:
7+
#
8+
# ARDUINO_LIBS = Ethernet Ethernet/utility SPI
9+
# BOARD_TAG = uno
10+
# ARDUINO_PORT = /dev/cu.usb*
11+
#
12+
# include /usr/share/arduino/Arduino.mk
13+
#
14+
# Hopefully these will be self-explanatory but in case they're not:
15+
#
16+
# ARDUINO_LIBS - A list of any libraries used by the sketch (we
17+
# assume these are in $(ARDUINO_DIR)/hardware/libraries
18+
# or your sketchbook's libraries directory)
19+
#
20+
# ARDUINO_PORT - The port where the Arduino can be found (only needed
21+
# when uploading)
22+
#
23+
# BOARD_TAG - The ard-parse-boards tag for the board e.g. uno or mega
24+
# 'make show_boards' shows a list
25+
#
26+
# If you have your additional libraries relative to your source, rather
27+
# than in your "sketchbook", also set USER_LIB_PATH, like this example:
28+
#
29+
# USER_LIB_PATH := $(realpath ../../libraries)
30+
#
31+
# If you've added the Arduino-Makefile repository to your git repo as a
32+
# submodule (or other similar arrangement), you might have lines like this
33+
# in your Makefile:
34+
#
35+
# ARDMK_DIR := $(realpath ../../tools/Arduino-Makefile)
36+
# include $(ARDMK_DIR)/arduino-mk/Arduino.mk
37+
#
38+
# In any case, once this file has been created the typical workflow is just
39+
#
40+
# $ make upload
41+
#
42+
# All of the object files are created in the build-{BOARD_TAG} subdirectory
43+
# All sources should be in the current directory and can include:
44+
# - at most one .pde or .ino file which will be treated as C++ after
45+
# the standard Arduino header and footer have been affixed.
46+
# - any number of .c, .cpp, .s and .h files
47+
#
48+
# Included libraries are built in the build-{BOARD_TAG}/libs subdirectory.
49+
#
50+
# Besides make upload you can also
51+
# make - no upload
52+
# make clean - remove all our dependencies
53+
# make depends - update dependencies
54+
# make reset - reset the Arduino by tickling DTR on the serial port
55+
# make raw_upload - upload without first resetting
56+
# make show_boards - list all the boards defined in boards.txt
57+
# make monitor - connect to the Arduino's serial port
58+
# make size - show the size of the compiled output (relative to
59+
# resources, if you have a patched avr-size)
60+
# make disasm - generate a .lss file in build-cli that contains
61+
# disassembly of the compiled file interspersed
62+
# with your original source code.
63+
# make verify_size - Verify that the size of the final file is less than
64+
# the capacity of the micro controller.
65+
# make eeprom - upload the eep file
66+
# make raw_eeprom - upload the eep file without first resetting
67+
#
68+
########################################################################
69+
#
70+
# SERIAL MONITOR
71+
#
72+
# The serial monitor just invokes the GNU screen program with suitable
73+
# options. For more information see screen (1) and search for
74+
# 'character special device'.
75+
#
76+
# The really useful thing to know is that ^A-k gets you out!
77+
#
78+
# The fairly useful thing to know is that you can bind another key to
79+
# escape too, by creating $HOME{.screenrc} containing e.g.
80+
#
81+
# bindkey ^C kill
82+
#
83+
# If you want to change the baudrate, just set MONITOR_BAUDRATE. If you
84+
# don't set it, it tries to read from the sketch. If it couldn't read
85+
# from the sketch, then it defaults to 9600 baud.
86+
#
87+
########################################################################
88+
89+
ARDUINO_LIBS = SPI SoftwareSerial
90+
BOARD_TAG = uno
91+
ARDUINO_PORT = /dev/ttyACM*
92+
include /usr/share/arduino/Arduino.mk

Read_Mainpage/Read_Mainpage.ino

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
/*
22
Read_Mainpage
3-
4-
Reads MainPage flash contents from Nordic nRF24LE1 SOC RF chips using SPI interface from
3+
4+
Reads MainPage flash contents from Nordic nRF24LE1 SOC RF chips using SPI interface from
55
an Arduino.
6-
6+
77
Upload sketch, start serial monitor, type 'GO' to start sketch running.
8-
8+
99
Copyright (c) 2014 Dean Cording
10-
10+
1111
Permission is hereby granted, free of charge, to any person obtaining a copy
1212
of this software and associated documentation files (the "Software"), to deal
1313
in the Software without restriction, including without limitation the rights
1414
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1515
copies of the Software, and to permit persons to whom the Software is
1616
furnished to do so, subject to the following conditions:
17-
17+
1818
The above copyright notice and this permission notice shall be included in
1919
all copies or substantial portions of the Software.
20-
20+
2121
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2222
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2323
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2424
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2525
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2626
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2727
THE SOFTWARE.
28-
28+
2929
*/
3030

3131
/*
@@ -96,7 +96,7 @@
9696
#define RDISMB 0x85 // Enable flash readback protection
9797
#define ENDEBUG 0x86 // Enable HW debug features
9898

99-
/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters.
99+
/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters.
100100
* Erasing the content of this area WILL cause changes to device behavior and performance. InfoPage area
101101
* DSYS should ALWAYS be read out and stored prior to using ERASE ALL. Upon completion of the
102102
* erase the DSYS information must be written back to the flash InfoPage.
@@ -132,15 +132,18 @@ void setup() {
132132

133133
Serial.println("READY");
134134
// Wait for GO command from Serial
135-
//while (!Serial.find("GO\n"));
135+
while (!Serial.find("GO\n"));
136+
Serial.println("READYING");
137+
delay(1000);
138+
Serial.println("SETTING UP");
136139

137140
// Put nRF24LE1 into programming mode
138141
digitalWrite(PROG, HIGH);
139142
digitalWrite(_RESET_, LOW);
140143
delay(10);
141144
digitalWrite(_RESET_, HIGH);
142145

143-
// Set InfoPage bit so InfoPage flash is read
146+
// Set InfoPage bit so InfoPage flash is read
144147
digitalWrite(_FCSN_, LOW);
145148
SPI.transfer(RDSR);
146149
fsr = SPI.transfer(0x00);
@@ -170,15 +173,15 @@ void setup() {
170173
SPI.transfer(READ);
171174
SPI.transfer(0);
172175
SPI.transfer(0);
173-
for (int index = 0; index < 100; index++) {
176+
for (int index = 0; index < 16*1024; index++) {
174177
spi_data = SPI.transfer(0x00);
175178
Serial.print(index);
176179
Serial.print(": ");
177180
Serial.println(spi_data);
178181
}
179-
digitalWrite(_FCSN_, HIGH);
182+
digitalWrite(_FCSN_, HIGH);
180183

181-
done:
184+
done:
182185
Serial.println("DONE");
183186

184187
// Take nRF24LE1 out of programming mode
@@ -194,7 +197,7 @@ done:
194197

195198

196199
void loop() {
197-
200+
198201
// Do nothing
199202
delay(1000);
200203
}

0 commit comments

Comments
 (0)