How to manage 120*8*16 microcontrollers? - Page 1
Forum section: electronics / projects

author: JohanHoltby
author_rank: Contributor
timestamp: June 02, 2019, 05:07:11 am
content: Hi!I'm designing a 40 ports Solid state relay switch and I need to monitor each port for voltage and current at about 1Ms/S. I would also like to store the streaming data in an SDRAM (3.3V compatible) for the last 8 seconds. So using a 128Mbit should do.My initial idea is to use two 30-50 cent microcontrollers, one for current and one for voltage (one to high side and one to low side of the SSR driver) and then let them output 8bit each to the the memory pins and then have a third IC to control the Memory addressing. All this three would run in sync using some common clock source.To add on this I will stack this boards. To about 8 boards in total and could probably have around 16 of this stacks.So this would leave me with about 120 microcontrollers and that would give me three challenges:Which bus should I use? I could decide to only communicate with the Memmory chip that would reduce it to 40.Since I will run sensitive analog signals through this board will I have problems or will it be solvable with a multi layer board?How do I program them? Is JTAG dasychain the only option other that some switching needle bed?Is there a better way to do it?

author: MosherIV
author_rank: Super Contributor
timestamp: June 02, 2019, 10:21:04 am
content: Hi. You are suggesting a 'polling' type scheme, where you store all the results in the RAM. This results in a bandwidth problem. Hence your questiin about whuch bus and protocolTry changing the problem around. Instead of polling try a interrupt scheme.In other words, only send information when there is a state change.This should reduce the bandwidth if the state/current/voltage does not change often.This will allow lower requirements for the bus and protocol.

author: OM222O
author_rank: Frequent Contributor
timestamp: June 02, 2019, 12:18:07 pm
content: 128Mbit * 120 micros = 15360Mbit/s = 15Gbit/scall me crazy but at a lot of places you can't get more than Gigabit internet ... your application requires 2 10Gbit connections. that's just to put things in perspective. why do you want to sample at such a high rate for 40 ports at the same time? even then, why would you want to share that data with another computer / MCU / etc. ?the only thing I can think of would be an electronic fuse for over voltage / over current protection but that doesn't require sharing that info

author: Siwastaja
author_rank: Super Contributor
timestamp: June 02, 2019, 12:54:59 pm
content: By solid state relay, you mean power line AC?Are you really sure you want to sample at such rate? What information are you expecting to see at such high frequencies?

author: coromonadalix
author_rank: Super Contributor
timestamp: June 02, 2019, 02:37:03 pm
content: Im doing almost the same thing with 3x usb NiDac 16 input ports (each), i monitor rf output of the boards i test, they are medical grade/certified boards.It consume lots of ressources to get the job going, i had to slower the sample rate, now at 1 measurment in 3 seconds interval each board, i was doing it a 1 sec intervals loll and save the log into a text file and a bitmap for ISO purposes ...The only safety i use is: a countdown timer, it will cut off all the tests past the software programmed cycle, and for added protection, all the DC supplies line are short protected and fused in case of ...I do this on a dual core pc 4gb ram with an oooold windows XP loll The software was custom made for us, but no updates sinceAnd as other replied, why do you need to measure up to 1ms/secis it too critical ??

author: Siwastaja
author_rank: Super Contributor
timestamp: June 02, 2019, 02:47:13 pm
content: For such systems, it's not a bad idea to use distributed simple serial (SPI, for example) ADCs, and use a large FPGA with a lots of IO to collect and packetize the data for whatever high-BW output medium. If necessary, you can use digital isolators easily in the SPI links.Pre-analysis, filtration and compression on FPGA could make data reduction possible, allowing standard gigabit ethernet or USB to be used even if the amount of input data is much more.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: June 02, 2019, 03:02:33 pm
content: General rule - only use multiple MCUs when there are really good reasons to - it's always more complicated and debugging can be a nightmare.The scheme you propose is just crazy unless maybe you need galvanic isolation- using a single MCU to do everything will be much, much easier. If you need isolation.BTW you can get 64Mbit SPI SRAMs, which will be much easier to drive than SDRAM :https://lcsc.com/product-detail/RAM_VTI7064MSME_C139966.html

author: ogden
author_rank: Super Contributor
timestamp: June 02, 2019, 04:11:45 pm
content: Quote from: mikeselectricstuff on June 02, 2019, 03:02:33 pmYes, sort of. On the opther hand if you consider preprogrammed MCU (in-house or not) as any other IC you buy, then idea is not that crazy anymore. Still it is so that 1Msps 12bit ADC standalone chips are more expensive than MCU with kinda equivalent ADC peripheral. I think OP is thinking similar way.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: June 02, 2019, 04:43:39 pm
content: Unless you're making thousands, the cost of the MCU is pretty insignificant compared to the development effort, not to mention the logisitics of dealing with multiple sets of firmware.One thing you can usefully do if all MCUs are the same type, is have one common firmware image in all MCUs, and have a pin tied on the PCB, or something similar, to tell it which position it is in.

author: ogden
author_rank: Super Contributor
timestamp: June 02, 2019, 05:46:42 pm
content: Quote from: mikeselectricstuff on June 02, 2019, 04:43:39 pmSure. Code audit and testing costs are high as well. Thou you could be mad scientist or just hobbyist making steampunk multichannel analog input (card) for yourselfQuoteNot every MCU firmware shall be updated as often as Windows. When you select ADC chip, you supposedly do not change it often during lifetime of your product. MCU "ADC firmware" can be made once and that's it - your MCU becomes ADC IC. If preprogrammed - you even stock it along with other components.It is even better from logistics point of view - you have to stock just single type of ADC "tempate" in form of blank MCU's

author: Siwastaja
author_rank: Super Contributor
timestamp: June 02, 2019, 06:14:03 pm
content: Yes, I agree with ogden in the idea that if the firmware for the "node" is really super simple enough, it's fine to prototype the software once and then mass program.If it's <100 lines, configuring ADC and SPI, or possibly bitbanging a simple control interface, then chances that there is a hard-to-find, hidden bug left after initial development is small. It's nonzero, but you can take the controlled risk.I have been pushing my luck to >1000 lines of code, more complex distributed designs and have been quite succesful, but yeah, I understand it's a bit scary.But if a cheap SPI ADC does the job, I wouldn't go this way just to save some cents; the price difference isn't that much. OTOH, if the SPI ADC doesn't somehow produce the wanted datastream format, for any reason, then an MCU replacement quickly becomes attractive.Those On-Time-Programmable cheap Chinese controllers would be spot-on. Yes, there is a risk, but also learning opportunities.

author: JohanHoltby
author_rank: Contributor
timestamp: June 02, 2019, 10:12:43 pm
content: Wow. Such great thoughts from all! THANK YOU! I have done some more thinking after reading your thoughts and will go with a larger singel chip IC like STM32F3... There is some which have 4 ADCs with 5Msps which would reduce the complexity very much.Quote from: OM222O on June 02, 2019, 12:18:07 pm& and many more.Yes that would be crazy. That is why I use the memory. I want to be able to break the system and evaluate what the **** happened.The bus speed only need to be about 500kbit/s when the data is fetch out from the system. I'm leaning to RS485 right now. Good or bad?Quote from: Siwastaja on June 02, 2019, 02:47:13 pmThis is a cost constraint. The SPI ADCs cost more than a MCU. But as other have pointed out I will run in to problem if i try to program them before i place themifwhen I find a bug. JTAG might be an option if I use the STM chip maybe?...Quote from: mikeselectricstuff on June 02, 2019, 03:02:33 pmGreat I will keep them in mind for the future. They was quite costly but definitely interesting if I would go with a single MCU for every function. That is no longer the case due to the feed back I have received. I still have the challenge of using only 3.3V RAM chips. Most in lower voltage especially the ones cost less.Quote from: coromonadalix on June 02, 2019, 02:37:03 pmNo 1ms/sec is not critical and it's not a hard constraint but it would be nice to know what did happened in the system and when.

author: jmelson
author_rank: Super Contributor
timestamp: June 02, 2019, 10:14:40 pm
content: I just designed a 512-channel power supply to bias silicon photomultipliers. Each needs a slightly different voltage to give the correct gain. We also wanted current readout.So, this thing will have 512 channels of DACs to set the voltage, and 512 channels of ADCs to read the current.I did this all with ONE computer, a Beagle Bone Black. Due to the large amount of channels, I used the PRU (200 MIPS microcontroller) to do the low-level I/O. This is not fast sampling, but can read all the channels in a few milliseconds.If I understand your subject line correctly, you are talking about using 15,360 microcontrollers? YIKES!Jon

author: chris_leyson
author_rank: Super Contributor
timestamp: June 02, 2019, 10:36:42 pm
content: If you put a small micro onto an FPGA then from Xilinx KCPSM6 user guideQuote. State machines would be more economical for this application.

author: JohanHoltby
author_rank: Contributor
timestamp: June 02, 2019, 10:40:03 pm
content: I have got so much bash I will not go there (thankfully). I will use only some higher lever higher speed MCUs. My current plan is STM32G3 or STM32F3 and use about 4 per board. As you indicated my original plan would have given me some headache.

author: ogden
author_rank: Super Contributor
timestamp: June 03, 2019, 07:21:30 am
content: Quote from: JohanHoltby on June 02, 2019, 10:12:43 pmHow do you know which exactly channel contains data you are looking for? If you need to analyze whole set of data, it is: 16bits * 1MSPS * 8seconds * 120*8*16 = 245.7 Terabytes. Using 500kbps you need 15.6 years to read everything.QuoteBad. It does not solve you anything, only adds additional networking layer to implement and debug. Get your data into Ethernet as soon as you can. Check what CERN scientists with LHC science instruments do.QuoteSelf-programming over data interface.

author: Siwastaja
author_rank: Super Contributor
timestamp: June 03, 2019, 07:27:15 am
content: Quote from: JohanHoltby on June 02, 2019, 10:12:43 pmAgain, what do you expect to happen at such small timescale?Power lines tend not to have such dynamics, there's inductance in wiring, and capacitance in loads, all over the place.For some kind of EMI analysis, I'd kinda understand that, but then you would like to have even more bandwidth, and look at radiated electromagnetic fields.

author: JohanHoltby
author_rank: Contributor
timestamp: June 03, 2019, 10:11:02 am
content: Quote from: ogden on June 03, 2019, 07:21:30 amDue to the nature of the system. If I see a problem i can follow the trace of clues and check for reasons without a need for a re run. Think of it like a LTspice simulation but on the real deal. I will not download all data only the data of interest.Quote from: Siwastaja on June 03, 2019, 07:27:15 amGood point. Without a reason it would be stupid!I hope to find the reason why the system is behaving like it is. So this is mainly a feature for debugging. Think of it as a 1Mhz oscilloscope that knows every thing.....42...

author: tszaboo
author_rank: Super Contributor
timestamp: June 03, 2019, 10:33:19 am
content: What is the goal of the system? Overload protection? Diagnostics?In any case, there is usually very little reason to store all these data, unless you work at CERN.Your output is going to be 1 bit, the system is working or it doesnt work.Let the microcontollers do their job, and analyse the data. Have an open collector output for faults, and something like 485 or CAN for communication.Wherever it's possible, reduce the amount of data to something which is less. Do you need 1 million sample per sec from the microcontoller, or is it enough to have 1 sample of RMS value per second?Or you can replace the microcontroller with a comparator?

author: JohanHoltby
author_rank: Contributor
timestamp: June 03, 2019, 01:28:46 pm
content: It's diagnostics. CERN would be nice but no I don't work there. The problem is that I don't know what I need to extract from the raw data. I want it all.....But as you say. If I know what I want to know this is none optimal way of doing it, I agree.