Reading and Setting Variable from an external source

Hello all,

I am trying to work on an NRF based project using a standalone 328p running the standard bootloader and a 16Mhz with load caps. I would need to make multiple (TX,RX) pairs using different pipeline values and transmitter IDs.

I don't want to go into the code everytime, change the value, recompile and flash. I would prefer having finalised .hex file which reads once off of a text file to set the value before flashing. The text file will have the pipeline and transmitter ID variable which i would just change every pair.

I have standalone apps to flash the .hex file or i can just use avrdude from the terminal window.

A custom header file kindof does the job of reading it from an external source, but i have to re-compile that everytime to reflect the change before flashing which is something i am trying to avoid.

Any ideas on how to go about this are appreciated. Thanks in advance.

Store the data in the Arduino's EEPROM. That's not erased when the Arduino is reprogrammed, so unit #1 always remembers that it's #1.

You will have to write a small interface in your program so that you can enter these numbers via serial or whatever.

@MorganS, OP has a standalone mcu

Juraj:
@MorganS, OP has a standalone mcu

I don't get how that changes anything.

mustang82:
I don't want to go into the code everytime, change the value, recompile and flash. I would prefer having finalised .hex file which reads once off of a text file to set the value before flashing. The text file will have the pipeline and transmitter ID variable which i would just change every pair.

Please post the pair of programs you are using to communicate via the nRF24L01+ (?) modules. I have seen many cases with misconceptions about the use of Pipes and it may be there is a simple way to achieve what you require.

What sort of communication system are you trying to create? Will you have several separate pairs of nRF24s or will you have one "master" communicating with several slaves? Or something else?

Please also tell us how much data needs to be transferred, how frequently and if you need bi-directional communication.

For my own project I have a separate file that contains the wireless settings to ensure that the Rx and Tx use the same values for address and channel etc.

...R
Simple nRF24L01+ Tutorial

MorganS:
Store the data in the Arduino's EEPROM. That's not erased when the Arduino is reprogrammed, so unit #1 always remembers that it's #1.

You will have to write a small interface in your program so that you can enter these numbers via serial or whatever.

Sounds like something i can try.I just don't want a major latency because my project is realtime. Any inputs on the reliability of eeprom for long term read access ?

@Robin2 Thank you for the links. I have a one to one (Master-Slave) simplex comm.Where in the links are you using the code that accesses an external config file ?

mustang82:
@Robin2 Thank you for the links. I have a one to one (Master-Slave) simplex comm.Where in the links are you using the code that accesses an external config file ?

It's not in my links. It is part of one of my own projects.

Post your programs like I requested in Reply #4 and provide as much background info on your project as you can.

...R

mustang82:
Sounds like something i can try.I just don't want a major latency because my project is realtime. Any inputs on the reliability of eeprom for long term read access ?

Reading EEPROM is unlimited. It's close enough to the same speed as RAM too. (But you don't need to read your own serial number that often or that fast either.)

Writing to EEPROM however is limited: don't expect to get more than 100,000 writes. It's also much more time-consuming for the processor. That's why you use it for storing something like a serial number and not like main memory.

MorganS:
Reading EEPROM is unlimited. It's close enough to the same speed as RAM too. (But you don't need to read your own serial number that often or that fast either.)

Writing to EEPROM however is limited: don't expect to get more than 100,000 writes. It's also much more time-consuming for the processor. That's why you use it for storing something like a serial number and not like main memory.

The biggest challenge i am have right now is writing the const uint64_t to a 256x4 EEPROM on the atmega328. I have a 40bit address. i've used EEPROMWritelong() and EEPROMReadlong() for 32 bits but i don't know how to go about a long long situation.

mustang82:
The biggest challenge i am have right now is writing the const uint64_t to a 256x4 EEPROM on the atmega328.

I assume that is the address for communication. It does not have to be a uint64_t. Have a look at my tutorial which just uses 5 bytes.

...R

The biggest challenge i am have right now is writing the const uint64_t to a 256x4 EEPROM on the atmega328. I have a 40bit address. i've used EEPROMWritelong() and EEPROMReadlong() for 32 bits but i don't know how to go about a long long situation.

The OP said he was using standalone '328p's. Why the 256x4 EEPROM? 40 bit address? For what? Why not the internal 1Kx 8 in the 328?

Use the internal and EEPROMAnything to write and read any data type with the internal EEPROM.

https://playground.arduino.cc/Code/EEPROMWriteAnything