Help choosing microcontroller (CAN Open Safety project) - Page 1
Forum section: electronics / general

author: bulletbolt
author_rank: Newbie
timestamp: March 12, 2020, 02:33:11 pm
content: So I am hoping to get personal experiences of what MCU to choose.I'll start with the requirements:32bit128Kb ram+128Kb ROM+up to 100Mhz20-25 digital inputs20-25 analog inputs~5 analog outputs~5 digital outputsCAN bus connectivityHigh reliabilityIt would be used with the CAN Open Safety stack so speed and reliability is important but don't want to go in the range of frequency where EMC may become high risk.Would like to get some suggestions together with why it should be considered. Such as compiler, programming and debugging, bootloader availability etc.Ideally analog inputs would be rated up to 5VDC.Already looked at STM32F103 range but came across many negative feedback of various issues. Although it is cheap and there quite few projects in the net. Not sure if PIC/Atmel would be considered unless there is great argument.Thanks in advance

author: ajb
author_rank: Super Contributor
timestamp: March 12, 2020, 03:33:39 pm
content: I don't think there's any MCU that meets all of your requirements, particularly on the analog IO. 20-25 analog in and 25-30 digital IO is doable, although the analog will depend a lot on your sample rate and resolution requirements, but I don't think you're going to find anything with 5 DACs built in, let alone good ones. Maybe some DSPs? I would strike the analog out from your MCU requirements and plan on using an external DAC.In general, you probably want something in the ARM family, as that gives you a lot of options in the capabilities you want, and good toolchain and debugging support. ST, NXP, Atmel/Microchip are probably the most accessible (all very popular among DIY crowd, so lots of examples online), maybe TI and Cypress as well, but I think their portfolios are smaller than the other three. They all have parametric search, so you can easily narrow down the offerings to a short list based on your most critical requirements. Your memory size and clock speed requirements probably put you mostly in Cortex M4 territory. Maybe M7 as well, but note that the jump from M4 to M7 comes with more traps, including caches and memory access reordering that can be frustrating to figure out, especially for a beginner. ST, Atmel, and Cypress at least have their own IDEs that are basically install-and-go, and dev boards with built-in debuggers are readily available. You also have the option of building up your own environment using arm-gcc, gdb, and editor or IDE of your choice.Note that while analog inputs may be 5V tolerant, this does not necessarily mean that they can read analog voltages up to 5V. Typically you can only read up to the voltage of Vref, although some parts may have built-in scaling to extend to 2x Vref--although even here, this probably does not mean that they can read voltages above the analog supply voltage. That's not a big deal, though, because you can just use a voltage divider which provides some input protection as a bonus, and you generally want a bit of RC filtering on ADC inputs anyway. ST parts tend to have lots of 5V tolerant IO, though be away not all IO pins on a given part may be 5V tolerant.Many manufacturers have bootloaders available, many even have them baked into the MCU from the factory. These generally do not provide for encryption, though, so be aware that if this is something you release you may have to send your firmware in the clear.Regarding EMC, you're already going to be in the territory where that matters. It's not clock frequency that matters, it's the edge rate. Even a 1Hz square wave can be an EMI problem if the edge rate is fast enough. Good layout and slew rate management is essential for EMC. Many ARM parts especially in the M4 and up range allow you to configure the drive strength of the digital IO, so using the lowest drive strength that will do the job is best for EMC. Any signals that need high drive strength will benefit from careful layout and termination as necessary. (It's not a bad idea to design in series resistors (at least) at the source end of high speed signals; you can always fit 0R resistors if they turn out to be unnecessary.)Finally, what do you mean by "High Reliability"? Manufacturers make MCUs by the millions, so it's a pretty well dialed in process for the most part, as long as you follow good design practices you should be fine with just about anything. If this is something safety critical, well then you're in challenging terrain. You cannot build a reliably safe system (or even just a reliable system) just by buying "high reliability" parts. There are a lot of factors that go into both safety and reliability, and not all of them are trivial to analyze and verify. If you want to share some information about what exactly you're trying to accomplish I'm sure you will get lots of input here.

author: bulletbolt
author_rank: Newbie
timestamp: March 12, 2020, 04:07:26 pm
content: Thank you for the swift reply ajb.The reason of having many analog inputs is mainly because of each control having a redundant output. So i.e. 8 hall switches will have 16 analog outputs in the range of 0.5-4.5VDC. The resolution is I assume pretty low as the signal range (0.5-4.5vdc) gets converted into digital values (range 0-255). Dividing the output voltage is not an issue at all, as you pointed out, it will help with filtering too.I was expecting that ARM will be suggested but probably I am more concerned of what's the best package in terms of toolchain, programmer in circuit etc. Although I wouldn't consider M7 as the price-per-functionality is bit over the budget and I already know of some potential challenges I'd like to avoid.Ideally I would like to go with chip that comes with bootloader but at the same time there must be option to update it if needed.Analog output would only be required for things like buzzer which I believe would not be a challenge for majority of MCU's.I may have used wrong words. With reliability I meant wider range of storage and operational temperatures, not subject to vibration and moisture.

author: nctnico
author_rank: Super Contributor
timestamp: March 12, 2020, 04:12:57 pm
content: Look at NXP. The LPC series ARM controllers have CAN and automotive temperature ranges but they also carry a large range of automotive grade parts from formerly Freescale. NXP's LPC series have a very good & easy to use bootloader (and third party software called 'flash magic'). My customers have no problems getting a board updated if necessary.

author: ddavidebor
author_rank: Super Contributor
timestamp: March 12, 2020, 04:14:13 pm
content: check STM32, they offer models matching your requirements and have the best development tools in the industry for free (Atollic truestudio). Also, great pricing and range.

author: bulletbolt
author_rank: Newbie
timestamp: March 13, 2020, 09:08:39 am
content: Thank you for the replies.I have gathered few options of what I can potentially use.The list comprises:LPC17xxLPC40xxLPC546xxSTM32H7xxSTM32F1xxSTM32F4xxI will likely have to use ADC for analog inputs but hoping my digital inputs will be able to feed straight into MCU. So should really live with 64-100 pin chipNow, as for development software, NXP hasMCUXpressoand the ST hasSTM32CubeIDE. Can anyone point out pros and cos of these two based on personal experience? AFAIK they both are free to use and able to do certain debugging. Only used PIC software before and this is new field for me. Any feedback appreciated

author: Scrts
author_rank: Frequent Contributor
timestamp: March 13, 2020, 06:12:02 pm
content: If High-Reliability is a hard requirement, then probably you need to look into Automotive series. We're using ST SPC56 and Renesas F1L/F1H in automotive now and both seem to work fine. For small communication and control we also use STM8A.

author: bulletbolt
author_rank: Newbie
timestamp: March 16, 2020, 09:11:51 am
content: It is not MIL spec requirement but the product will spend 99% of it's time outdoors, in any country in the world. Operating temperature would be in the range of -20 to +80 (considering exposure to hot sun in the middle of the summer), certain vibration level (mainly caused by cheap diesel generators) and some abuse from end user (such as 'woops, hammer slipped out of hand' impacts, although not direct to the PCB)Your suggested SPC has high pin counts which is something we are trying to avoid, since the PCB is fairly big and may be subject to some bending. Also the price seems to be double compared to STM32F413RG which we have as option 1 at the moment.But thank you for recommendation, it may be considered for other application.

author: fchk
author_rank: Frequent Contributor
timestamp: March 16, 2020, 11:21:21 am
content: For safety, look here:http://www.ti.com/microcontrollers/hercules-safety-mcus/overview.htmlThey already have IEC 61508 SIL 3 and ISO26262 ASIL D certifications, and they are version qualified for -40 to +125 degC.This should be quite a safe way to go. All memory is ECC protected, the two cores run in lockstep mode, there are qualified self-diagnostic software modules, and much more.fchk

author: bulletbolt
author_rank: Newbie
timestamp: March 16, 2020, 12:33:14 pm
content: That's really good, thank you!TMS570LS0232 seems to have lots of potential in this case, plenty of features and priced very well.How about implementation? TI toolchain etc?

author: fchk
author_rank: Frequent Contributor
timestamp: March 16, 2020, 01:55:18 pm
content: Quote from: bulletbolt on March 16, 2020, 12:33:14 pmThere is a Launchpad for quick tryout:http://www.ti.com/tool/LAUNCHXL2-TMS57012https://uk.farnell.com/texas-instruments/launchxl2-tms57012/eval-board-tms57012-hercules-launchpad/dp/3009875?st=LAUNCHXL2-TMS57012Code Composer ist free since version 7:http://www.ti.com/tool/CCSTUDIO-SAFETYfchk

author: bulletbolt
author_rank: Newbie
timestamp: March 16, 2020, 02:17:09 pm
content: What about in circuit programmer?I spent some time in TI website but could not find any information. Do they not have own tool? Or it's all done via direct USB?

author: fchk
author_rank: Frequent Contributor
timestamp: March 16, 2020, 03:12:16 pm
content: Segger JLINK is supported.And they have their own:Highest Performance with realtime trace, very expensive!http://www.ti.com/tool/TMDSEMU560V2STM-UEFaster:http://www.ti.com/tool/TMDSEMU200-UCheaper:http://www.ti.com/tool/TMDSEMU110-UThe Launchpads have their own XDS110 onboard.You won't need more then an XDS200.fchkPS:http://www.ti.com/tool/HALCOGEN

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 02, 2020, 02:28:46 am
content: As of analog inputs...One way to make a rudimentary ADC is with a RC circuit:1. Set pin to output low, and discharge capacitor.2. Set pin to input and wait until it goes high, measure time.3. Set pin to output high, charge capacitor.4. Set pin to input and wait until it goes low.Bit of math magic to deduce an input voltage.You can also do this with 2 pins. One pin just measures, and the other charges and discharges the capacitor via a resistor. and then deduce input voltage from the assymmetry of the logic input.