I am planning a small cluster (~9 Nanos and a RasPI as Master). As communication I will use RS485 modules since the distances are up to 15m. At least three Nanos are not very easy accessible (one is even 0.5m under earth). My problem is the maintenance of the code. It may needs to be changed dependent on the math I use for the devices connected. I would like to upload sketches without the need of the USB interface.
I already used the ISP interface for another problem (no bootloader on device), but for this I would need 4 extra wires to connect to the master (MISO,MOSI,SCK and RST). This might be possible since wire diameter is not an immediate problem, but I am not sure about the maximum length a stable connection is possible.
I have two questions:
Is it possible to upload sketches using RS485 (similar this module)?
Can I use the ISP interface (or the pins directly) over 15m?
The system depends on continuous measurement from the other devices. Therefore I need to change the 'dynamic' of the system. Parameters also change, but that I can manage over the RS485 und a getter-Method.
You can't use ISP over 15 meters, so just forget about that right off
The bootloader is just running over a serial connection: USB isn't specifically required. You can do this over RS485. The problem is that at the end of the upload you'll need to reset the CPU to run your new code. If you have another I/O line from the Pi that you could use to reset the Nano that would work, alternately you'd have to modify the bootloader code.
Actually, I can pretty much guarantee you that this problem has been solved many times. I've written enough bootloaders to know that. Should just be a matter of spending a few minutes with google.
I am still in the planning phase. The prototypes are sitting in my laboratory and communicating correctly. Sensors, actors, etc behave as expected. I used the RS485 module before, so there is no problem there.
@cedarlakeinstruments maybe I use the wrong search words ("upload sketch via rs485, upload sketch without USB, bootloader ISP,...)
@anon57585045: the reality is that remote updates are pretty much expected these days, no matter how well you plan. So unless you're making the most basic of basic devices, at some point someone will want to change the code.
I spent the last few years working with wearable wireless devices and updating those things over BLE is a royal Pain In The Ass, but it's come to be expected. It's the engineer's job to suffer so the user doesn't have to
if the RS485 modules are on hw Serial and the MCU has a serial bootloader, then you only need to send a message to the sketch to self reset and then upload with avrdude.
Possible. It may be better to use the slaves just as datalogger and send just raw data back to the master. Another side note: I am not that confident in my code to commit it to the devices.