diff --git a/.gitignore b/.gitignore index 7b6afbc..74fa4b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/.directory +**/build-* diff --git a/Read_Infopage/Makefile b/Read_Infopage/Makefile new file mode 100644 index 0000000..389b79d --- /dev/null +++ b/Read_Infopage/Makefile @@ -0,0 +1,92 @@ +# STANDARD ARDUINO WORKFLOW +# +# Given a normal sketch directory, all you need to do is to create +# a small Makefile which defines a few things, and then includes this one. +# +# For example: +# +# ARDUINO_LIBS = Ethernet Ethernet/utility SPI +# BOARD_TAG = uno +# ARDUINO_PORT = /dev/cu.usb* +# +# include /usr/share/arduino/Arduino.mk +# +# Hopefully these will be self-explanatory but in case they're not: +# +# ARDUINO_LIBS - A list of any libraries used by the sketch (we +# assume these are in $(ARDUINO_DIR)/hardware/libraries +# or your sketchbook's libraries directory) +# +# ARDUINO_PORT - The port where the Arduino can be found (only needed +# when uploading) +# +# BOARD_TAG - The ard-parse-boards tag for the board e.g. uno or mega +# 'make show_boards' shows a list +# +# If you have your additional libraries relative to your source, rather +# than in your "sketchbook", also set USER_LIB_PATH, like this example: +# +# USER_LIB_PATH := $(realpath ../../libraries) +# +# If you've added the Arduino-Makefile repository to your git repo as a +# submodule (or other similar arrangement), you might have lines like this +# in your Makefile: +# +# ARDMK_DIR := $(realpath ../../tools/Arduino-Makefile) +# include $(ARDMK_DIR)/arduino-mk/Arduino.mk +# +# In any case, once this file has been created the typical workflow is just +# +# $ make upload +# +# All of the object files are created in the build-{BOARD_TAG} subdirectory +# All sources should be in the current directory and can include: +# - at most one .pde or .ino file which will be treated as C++ after +# the standard Arduino header and footer have been affixed. +# - any number of .c, .cpp, .s and .h files +# +# Included libraries are built in the build-{BOARD_TAG}/libs subdirectory. +# +# Besides make upload you can also +# make - no upload +# make clean - remove all our dependencies +# make depends - update dependencies +# make reset - reset the Arduino by tickling DTR on the serial port +# make raw_upload - upload without first resetting +# make show_boards - list all the boards defined in boards.txt +# make monitor - connect to the Arduino's serial port +# make size - show the size of the compiled output (relative to +# resources, if you have a patched avr-size) +# make disasm - generate a .lss file in build-cli that contains +# disassembly of the compiled file interspersed +# with your original source code. +# make verify_size - Verify that the size of the final file is less than +# the capacity of the micro controller. +# make eeprom - upload the eep file +# make raw_eeprom - upload the eep file without first resetting +# +######################################################################## +# +# SERIAL MONITOR +# +# The serial monitor just invokes the GNU screen program with suitable +# options. For more information see screen (1) and search for +# 'character special device'. +# +# The really useful thing to know is that ^A-k gets you out! +# +# The fairly useful thing to know is that you can bind another key to +# escape too, by creating $HOME{.screenrc} containing e.g. +# +# bindkey ^C kill +# +# If you want to change the baudrate, just set MONITOR_BAUDRATE. If you +# don't set it, it tries to read from the sketch. If it couldn't read +# from the sketch, then it defaults to 9600 baud. +# +######################################################################## + +ARDUINO_LIBS = SPI SoftwareSerial +BOARD_TAG = uno +ARDUINO_PORT = /dev/ttyACM* +include /usr/share/arduino/Arduino.mk diff --git a/Read_Infopage/Read_Infopage.ino b/Read_Infopage/Read_Infopage.ino index 5e06ac3..d0863e6 100644 --- a/Read_Infopage/Read_Infopage.ino +++ b/Read_Infopage/Read_Infopage.ino @@ -1,23 +1,23 @@ /* Read_Infopage - + Reads InfoPage contents from Nordic nRF24LE1 SOC RF chips using SPI interface from an Arduino. Useful for making a backup of the system variables stored in the InfoPage. - + Upload sketch, start serial monitor, type 'GO' to start sketch running. - + Copyright (c) 2014 Dean Cording - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -25,7 +25,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + */ /* @@ -96,7 +96,7 @@ #define RDISMB 0x85 // Enable flash readback protection #define ENDEBUG 0x86 // Enable HW debug features -/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters. +/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters. * Erasing the content of this area WILL cause changes to device behavior and performance. InfoPage area * DSYS should ALWAYS be read out and stored prior to using ERASE ALL. Upon completion of the * erase the DSYS information must be written back to the flash InfoPage. @@ -132,7 +132,10 @@ void setup() { Serial.println("READY"); // Wait for GO command from Serial - //while (!Serial.find("GO\n")); + while (!Serial.find("GO\n")); + Serial.println("READYING"); + delay(1000); + Serial.println("SETTING UP"); // Put nRF24LE1 into programming mode digitalWrite(PROG, HIGH); @@ -140,7 +143,7 @@ void setup() { delay(10); digitalWrite(_RESET_, HIGH); - // Set InfoPage bit so InfoPage flash is read + // Set InfoPage bit so InfoPage flash is read digitalWrite(_FCSN_, LOW); SPI.transfer(RDSR); fsr = SPI.transfer(0x00); @@ -178,7 +181,7 @@ void setup() { Serial.print(": "); Serial.println(spi_data); } - digitalWrite(_FCSN_, HIGH); + digitalWrite(_FCSN_, HIGH); done: Serial.println("DONE"); diff --git a/Read_Mainpage/Makefile b/Read_Mainpage/Makefile new file mode 100644 index 0000000..389b79d --- /dev/null +++ b/Read_Mainpage/Makefile @@ -0,0 +1,92 @@ +# STANDARD ARDUINO WORKFLOW +# +# Given a normal sketch directory, all you need to do is to create +# a small Makefile which defines a few things, and then includes this one. +# +# For example: +# +# ARDUINO_LIBS = Ethernet Ethernet/utility SPI +# BOARD_TAG = uno +# ARDUINO_PORT = /dev/cu.usb* +# +# include /usr/share/arduino/Arduino.mk +# +# Hopefully these will be self-explanatory but in case they're not: +# +# ARDUINO_LIBS - A list of any libraries used by the sketch (we +# assume these are in $(ARDUINO_DIR)/hardware/libraries +# or your sketchbook's libraries directory) +# +# ARDUINO_PORT - The port where the Arduino can be found (only needed +# when uploading) +# +# BOARD_TAG - The ard-parse-boards tag for the board e.g. uno or mega +# 'make show_boards' shows a list +# +# If you have your additional libraries relative to your source, rather +# than in your "sketchbook", also set USER_LIB_PATH, like this example: +# +# USER_LIB_PATH := $(realpath ../../libraries) +# +# If you've added the Arduino-Makefile repository to your git repo as a +# submodule (or other similar arrangement), you might have lines like this +# in your Makefile: +# +# ARDMK_DIR := $(realpath ../../tools/Arduino-Makefile) +# include $(ARDMK_DIR)/arduino-mk/Arduino.mk +# +# In any case, once this file has been created the typical workflow is just +# +# $ make upload +# +# All of the object files are created in the build-{BOARD_TAG} subdirectory +# All sources should be in the current directory and can include: +# - at most one .pde or .ino file which will be treated as C++ after +# the standard Arduino header and footer have been affixed. +# - any number of .c, .cpp, .s and .h files +# +# Included libraries are built in the build-{BOARD_TAG}/libs subdirectory. +# +# Besides make upload you can also +# make - no upload +# make clean - remove all our dependencies +# make depends - update dependencies +# make reset - reset the Arduino by tickling DTR on the serial port +# make raw_upload - upload without first resetting +# make show_boards - list all the boards defined in boards.txt +# make monitor - connect to the Arduino's serial port +# make size - show the size of the compiled output (relative to +# resources, if you have a patched avr-size) +# make disasm - generate a .lss file in build-cli that contains +# disassembly of the compiled file interspersed +# with your original source code. +# make verify_size - Verify that the size of the final file is less than +# the capacity of the micro controller. +# make eeprom - upload the eep file +# make raw_eeprom - upload the eep file without first resetting +# +######################################################################## +# +# SERIAL MONITOR +# +# The serial monitor just invokes the GNU screen program with suitable +# options. For more information see screen (1) and search for +# 'character special device'. +# +# The really useful thing to know is that ^A-k gets you out! +# +# The fairly useful thing to know is that you can bind another key to +# escape too, by creating $HOME{.screenrc} containing e.g. +# +# bindkey ^C kill +# +# If you want to change the baudrate, just set MONITOR_BAUDRATE. If you +# don't set it, it tries to read from the sketch. If it couldn't read +# from the sketch, then it defaults to 9600 baud. +# +######################################################################## + +ARDUINO_LIBS = SPI SoftwareSerial +BOARD_TAG = uno +ARDUINO_PORT = /dev/ttyACM* +include /usr/share/arduino/Arduino.mk diff --git a/Read_Mainpage/Read_Mainpage.ino b/Read_Mainpage/Read_Mainpage.ino index 08c103f..73c2949 100644 --- a/Read_Mainpage/Read_Mainpage.ino +++ b/Read_Mainpage/Read_Mainpage.ino @@ -1,23 +1,23 @@ /* Read_Mainpage - - Reads MainPage flash contents from Nordic nRF24LE1 SOC RF chips using SPI interface from + + Reads MainPage flash contents from Nordic nRF24LE1 SOC RF chips using SPI interface from an Arduino. - + Upload sketch, start serial monitor, type 'GO' to start sketch running. - + Copyright (c) 2014 Dean Cording - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -25,7 +25,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + */ /* @@ -96,7 +96,7 @@ #define RDISMB 0x85 // Enable flash readback protection #define ENDEBUG 0x86 // Enable HW debug features -/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters. +/* NOTE: The InfoPage area DSYS are used to store nRF24LE1 system and tuning parameters. * Erasing the content of this area WILL cause changes to device behavior and performance. InfoPage area * DSYS should ALWAYS be read out and stored prior to using ERASE ALL. Upon completion of the * erase the DSYS information must be written back to the flash InfoPage. @@ -132,7 +132,10 @@ void setup() { Serial.println("READY"); // Wait for GO command from Serial - //while (!Serial.find("GO\n")); + while (!Serial.find("GO\n")); + Serial.println("READYING"); + delay(1000); + Serial.println("SETTING UP"); // Put nRF24LE1 into programming mode digitalWrite(PROG, HIGH); @@ -140,7 +143,7 @@ void setup() { delay(10); digitalWrite(_RESET_, HIGH); - // Set InfoPage bit so InfoPage flash is read + // Set InfoPage bit so InfoPage flash is read digitalWrite(_FCSN_, LOW); SPI.transfer(RDSR); fsr = SPI.transfer(0x00); @@ -170,15 +173,15 @@ void setup() { SPI.transfer(READ); SPI.transfer(0); SPI.transfer(0); - for (int index = 0; index < 100; index++) { + for (int index = 0; index < 16*1024; index++) { spi_data = SPI.transfer(0x00); Serial.print(index); Serial.print(": "); Serial.println(spi_data); } - digitalWrite(_FCSN_, HIGH); + digitalWrite(_FCSN_, HIGH); -done: +done: Serial.println("DONE"); // Take nRF24LE1 out of programming mode @@ -194,7 +197,7 @@ done: void loop() { - + // Do nothing delay(1000); } diff --git a/Restore_Infopage/Makefile b/Restore_Infopage/Makefile new file mode 100644 index 0000000..389b79d --- /dev/null +++ b/Restore_Infopage/Makefile @@ -0,0 +1,92 @@ +# STANDARD ARDUINO WORKFLOW +# +# Given a normal sketch directory, all you need to do is to create +# a small Makefile which defines a few things, and then includes this one. +# +# For example: +# +# ARDUINO_LIBS = Ethernet Ethernet/utility SPI +# BOARD_TAG = uno +# ARDUINO_PORT = /dev/cu.usb* +# +# include /usr/share/arduino/Arduino.mk +# +# Hopefully these will be self-explanatory but in case they're not: +# +# ARDUINO_LIBS - A list of any libraries used by the sketch (we +# assume these are in $(ARDUINO_DIR)/hardware/libraries +# or your sketchbook's libraries directory) +# +# ARDUINO_PORT - The port where the Arduino can be found (only needed +# when uploading) +# +# BOARD_TAG - The ard-parse-boards tag for the board e.g. uno or mega +# 'make show_boards' shows a list +# +# If you have your additional libraries relative to your source, rather +# than in your "sketchbook", also set USER_LIB_PATH, like this example: +# +# USER_LIB_PATH := $(realpath ../../libraries) +# +# If you've added the Arduino-Makefile repository to your git repo as a +# submodule (or other similar arrangement), you might have lines like this +# in your Makefile: +# +# ARDMK_DIR := $(realpath ../../tools/Arduino-Makefile) +# include $(ARDMK_DIR)/arduino-mk/Arduino.mk +# +# In any case, once this file has been created the typical workflow is just +# +# $ make upload +# +# All of the object files are created in the build-{BOARD_TAG} subdirectory +# All sources should be in the current directory and can include: +# - at most one .pde or .ino file which will be treated as C++ after +# the standard Arduino header and footer have been affixed. +# - any number of .c, .cpp, .s and .h files +# +# Included libraries are built in the build-{BOARD_TAG}/libs subdirectory. +# +# Besides make upload you can also +# make - no upload +# make clean - remove all our dependencies +# make depends - update dependencies +# make reset - reset the Arduino by tickling DTR on the serial port +# make raw_upload - upload without first resetting +# make show_boards - list all the boards defined in boards.txt +# make monitor - connect to the Arduino's serial port +# make size - show the size of the compiled output (relative to +# resources, if you have a patched avr-size) +# make disasm - generate a .lss file in build-cli that contains +# disassembly of the compiled file interspersed +# with your original source code. +# make verify_size - Verify that the size of the final file is less than +# the capacity of the micro controller. +# make eeprom - upload the eep file +# make raw_eeprom - upload the eep file without first resetting +# +######################################################################## +# +# SERIAL MONITOR +# +# The serial monitor just invokes the GNU screen program with suitable +# options. For more information see screen (1) and search for +# 'character special device'. +# +# The really useful thing to know is that ^A-k gets you out! +# +# The fairly useful thing to know is that you can bind another key to +# escape too, by creating $HOME{.screenrc} containing e.g. +# +# bindkey ^C kill +# +# If you want to change the baudrate, just set MONITOR_BAUDRATE. If you +# don't set it, it tries to read from the sketch. If it couldn't read +# from the sketch, then it defaults to 9600 baud. +# +######################################################################## + +ARDUINO_LIBS = SPI SoftwareSerial +BOARD_TAG = uno +ARDUINO_PORT = /dev/ttyACM* +include /usr/share/arduino/Arduino.mk