Go Down

Topic: Dumping source code on 40+ Nano from a single point on SPI or Serial via FTDI (Read 397 times) previous topic - next topic

ramrada2002

Hi -

We are using 40+ Nano's for a single equipment - as we need multi-threading - it is imperative we had to go in for so many discrete controllers, now the challenge is to dump the source and making changes - means we have to use USB port of each controller.

Exploring - SPI - but then it calls for demultiplexing( need to use 5 of them of 8 channels each), again complex wiring.

Parallely exploring serial port with FTDI, here we had challenges of dumping programs through FTDI on Nano - some how doesn't seem to be working.

Appreciate ideas to solve this challenge

johnwasser

now the challenge is to dump the source and making changes
What do you mean by "dump the source"?  Did you hope to read an Arduino sketch out of the FLASH memory of the Nano?  The FLASH memory contains only binary machine code, not the sketch source.  If you don't have the sketch stored somewhere you will have to create it again.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

CrossRoads

I read that as sharing data between Nano's - add RS485 chip to each. Can have one master, it can command each slave to send data, slaves only respond when addressed to prevent data conflicts.

See "Selecting and using RS-232, RS-422, RS-485 Serial Data Standards, AN723" at https://www.maximintegrated.com/en/app-notes/index.mvp/id/723

MAX488 or similar chip at each Nano.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MorganS

40 seems like a lot. There must be some other constraint that you're not telling us. They get unplugged from each other in normal operation or there's some requirement for closed-loop control in 40 widely-spaced places?

Wireless units are cheaper than 50ft of cable. They can all participate in a wireless network. I would start investigating the Nordic chips for this. There's a lot of Arduino enthusiats with house-sized networks all talking on one frequency.
"The problem is in the code you didn't post."

CrossRoads

ramrada, are you asking about how to load a new sketch into 40 Nanos?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

TomGeorge

Hi,
What is the application that needs 40 nanos, there may be a simpler and lower controller count that will do the job?

Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

ramrada2002


ramrada2002

Application is every controller needs to run a closed loop within 10msecs continuously evaluate the dynamic values coming from the sensor - if I, include 40 loops in sequence on to one controller it takes 400msecs loop and other operations around 10omsecs, I, miss the reading from the sensors.

MorganS

10ms gives the Arduino 160,000 instructions to execute in that time. 40 analogRead()s might not be possible in that time, but there isn't 40 analog inputs. A faster microprocessor with more pins might be warranted.

But yes it's possible to load code onto 40 Nano's simultaneously. The trick is to parallel all the Rx lines to the one Tx coming from the PC. AVRDUDE does expect feedback from the Nano while it's uploading so connect just one Nano's Tx line to the PC Rx.

Fanout on 5V serial lines is usually not going to drive 40 inputs simultaneously. You will probably need an amplifier or repeater to boost the power for that many inputs.

You also won't get any feedback if a bunch of Nanos are a little slow and miss out on critical data. They may fail to program in a way that's difficult to detect - they could still be running the previous version of the program.

But this amount of effort is usually only needed if you're doing a production run of thousands and you need to program batches of 40 at a time. If there only ever will be 40 units then it's only an hour or so to load the code onto each one individually, after you've finalized the code.
"The problem is in the code you didn't post."

johnwasser

loading sketches from one point onto many Nano's
Sounds easy enough.  Put the "burn from SD card" sketch on an Arduino MEGA and modify the code to use 40 different pins for the Reset pin of the ICSP connector.  All the other ICSP pins are common.  You can leave out the Vcc pin if they all have power.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


CrossRoads

For your application, what if you run with external SPI ADCs?
An ADC that can take 100,000 samples per second like this one, MCP3208.
https://www.digikey.com/product-detail/en/microchip-technology/MCP3208-CI-P/MCP3208-CI-P-ND/305928
Runs with SPI clock divisor of 4, 2 MHz. Period of 0.5uS
One read takes 3 SPI.transfers, 24 clocks.  see figure 6-1. of the datasheet.
So a read needs 24 clocks x 0.5uS/clock = 0.12mS, and a loop to read 40 would be 4.8mS plus the loop timing.
So maybe not enough time to do it all in one 328P processor (Nano), but perhaps the number of units could be reduced quite a bit, to say 5 Nanos each with a 8-channel SPI ADC, each using ~ 1mS for 8 reads and 9mS for whatever processing needs to be done on the 8 data captures.
Faster ADCs are available as well, with faster clock rates and some needing just 2 SPI transfers for the conversion and 12-bit read out.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up