Microcontroller suggestions - Page 1
Forum section: electronics / general

author: ifrythings
author_rank: Contributor
timestamp: December 14, 2024, 01:48:56 pm
content: I’ve been working a lot with CAN bus with the arduino atmega328P and mcp2515 chip but I’m need something more powerful, I’m trying to make a gateway module so I’m looking for a chip that has 3-4 built in CAN bus controllers, probably going to need 32 bit unit, DMA would be nice but I don’t know much about DMA so it may or may not help me.I figured if I’m going to jump off the arduino band wagon and have to deep dive into learning a new micro, I should find something that fits my needs. So I’m looking for something that’s ideally 5v based, automotive recommended, something I can solder by hand like a lead package, decent IDE, not super expensive for a programmer or for the chip and bonus if there are usable examples to get started from.I’ve played with the teense 4.1 but I would like something that isn’t BGA and doesn’t cost $30+ CAD per unit and require a special chip to use.Any recommendations would be very helpful.

author: shtirka
author_rank: Contributor
timestamp: December 14, 2024, 03:03:12 pm
content: Hello,I can recommend 2 boards off the top of my head1. An STM32F446RET6 (has 2xCAN so maybe not quite up to your spec of 3+ can bus controllers) based board - you can look at the spec here->https://www.aliexpress.com/item/1005006051651136.html?pdp_npi=4%40dis%21SEK%21SEK%2060.34%21SEK%2055.74%21%21%2138.83%2135.87%21%40211b618e17341880756385929eeaee%2112000035503740771%21sh%21SE%21891317837%21X&spm=a2g0o.store_pc_allItems_or_groupList.new_all_items_2007524327660.10050060516511362. An STM32H723VGT6 (has 3 can controllers) based board - specs are here ->https://www.aliexpress.com/item/1005005872938104.html?pdp_npi=4%40dis%21SEK%21SEK%20208.33%21SEK%20194.53%21%21%21134.06%21125.18%21%40211b618e17341883428135326eeaee%2112000034654506457%21sh%21SE%21891317837%21X&spm=a2g0o.store_pc_allItems_or_groupList.new_all_items_2007524327660.1005005872938104Not entirely sure if any of them are automotive recommended though.They both can be programmed with STM32Cube IDE (which also includes examples).Ilya

author: Postal2
author_rank: Frequent Contributor
timestamp: December 14, 2024, 04:19:30 pm
content: If you are going to make a gateway for one slave device, you can easily do it using Arduino. If you are planning to make a universal filter that can be placed in the CAN break from the ECU, then you will not have enough power of any controller, and you will never do it. More precisely, there is a theoretical possibility, but it will be more difficult than using FPGA. 10 devices will send you messages to one end of the filter, and from the other end of the filter the ECU module will continuously send messages, for which there will be visibility of a free bus. You will not be able to debug such arbitration and it will not be universal.

author: ifrythings
author_rank: Contributor
timestamp: December 14, 2024, 05:38:05 pm
content: Quote from: shtirka on December 14, 2024, 03:03:12 pmI’ll keep those in mind and read about them a bit more tonight.

author: ifrythings
author_rank: Contributor
timestamp: December 14, 2024, 05:45:26 pm
content: Quote from: Postal2 on December 14, 2024, 04:19:30 pmNot trying to do flow control, just pass messages from one bus to another. I’m grafting some newer automotive modules to an older vehicle, so these newer modules need some of the data converted to a different format then transmitted on the appropriate bus. At most maybe 6-10 messages will be read and converted to the appropriate bus and transmitted, I don’t necessarily need 4 CAN controllers in one chip, I could do it with 2 or 3 separate controllers if need be.I have a few automotive gateway modules from a few ford trucks and they have 5 CAN busses going into one chip but it’s a custom Freescale chip that I can’t find any info about.

author: Postal2
author_rank: Frequent Contributor
timestamp: December 14, 2024, 06:08:05 pm
content: Quote from: ifrythings on December 14, 2024, 05:45:26 pmIn this case, you will need a number of filters equal to the number of your new modules. Use this:https://aliexpress.com/item/1005001620616382.htmlQuote from: ifrythings on December 14, 2024, 05:45:26 pmExactly.You can also use this link:https://github.com/moonglow/pcan_pro_xI can upload the firmware removed due to copyright here, and you will be able to configure filters using your computer.Also, if you order modules from my link, you will need USB-A male-male cables for each board; also, if you want to use ready-made firmware without recompiling, buy 8 MHz crystals for these boards. It is advisable to have STM32F407 in stock, because one of the 5 boards I received had a partially defective MCU.

author: NorthGuy
author_rank: Super Contributor
timestamp: December 14, 2024, 10:20:14 pm
content: The only MCU with 4 CAN modules I've seen is PIC32MK (not all of them have 4 CAN modules though, so choose carefully).

author: MathWizard
author_rank: Super Contributor
timestamp: December 14, 2024, 11:50:53 pm
content: So do you have to do anything different when making a PCB for a car, in regards to vibrations and acceleration/forces ? Back in the through hole days, they must have glued a lot of stuff down. I'd be curious to see side by side images of a regular PCB with regular solder, and the same one thats been bouncing around in a car for 10yrs.

author: ifrythings
author_rank: Contributor
timestamp: December 15, 2024, 01:48:15 pm
content: I do have a pickit 4 so I’ll order a few PIC32MK1024GPE064 to try out.Also found that NXP has a few options like the FS32K144HAT0MLFT, though I don’t hear many people using them in the DIY world, I’m not sure if they have an IDE or what their programmers cost. The mcu above looks promising and they do free samples on it, maybe worth trying if the programmer isn’t crazy expensive.Most automotive boards I’ve seen look the same after 10-15 years, they use a fairly heavy conformal coating and glue large components down, a lot of connectors aren’t even soldered anymore, they are just pressed into the board. The biggest thing I’ve seen with the automotive approved stuff is it’s been certified for the harsher environment of automotive life and noise and has a higher temperature rating of 125C. My application is going to be inside the cab and under the dash so I’m expecting the highest ambient temp to be around 50(ish)C.

author: shtirka
author_rank: Contributor
timestamp: December 15, 2024, 05:02:17 pm
content: if you in the future will still decide on STM32 for your can development, then there is this (https://www.aliexpress.com/item/1005005303809188.html?spm=a2g0o.store_pc_home.promoteWysiwyg_6000122603282.1005005303809188) debugger/programmer from the same webshop i linked to earlier for not a lot of money (about 5 bucks us). STM32Cube ide is free of chargeIlyaQuote from: ifrythings on December 15, 2024, 01:48:15 pm

author: ifrythings
author_rank: Contributor
timestamp: December 15, 2024, 05:41:28 pm
content: Quote from: shtirka on December 15, 2024, 05:02:17 pmI’ll order one of the STM32H723VGT6 boards and programmer to try it out also, the PIC is going to be a slow and large learning curve to get going as where it sounds like with the STM could be a good proof of concept tester and then move everything over to a 4 CAN device.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 15, 2024, 11:50:20 pm
content: Why 4 separate CAN?It's relatively rare indeed on MCUs. 1 or 2 max is more common. Also, does it need to support CAN FD? While it's been around for quite a while, MCUs supporting CAN FD are still a small fraction.

author: NorthGuy
author_rank: Super Contributor
timestamp: December 16, 2024, 12:24:39 am
content: Quote from: SiliconWizard on December 15, 2024, 11:50:20 pmYes, why? If you need to translate CAN messages for 3 (or any other number) external devices, why not to put all these devices on the same CAN bus (assuming they all require CAN of the same speed). They won't hurt each other. And you only need 2 CAN modules then - the main CAN, and one CAN bus for all your devices together.Even if different devices need different formats of the same CAN message from the main CAN, you can put two different messages onto the external CAN. The external nodes will see messages that they cannot understand, but they will simply ignore such messages.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 16, 2024, 12:59:08 am
content: The only reason I see is if the device needs to address several CAN busses concurrently (without having to plug/unplug) on similar devices (for instance cars) with the same CAN addresses. So maybe that's what the OP wants to do.Like, if you bridge (parallel) the CAN busses of several cars, I'm not sure that things will end up really well?

author: ifrythings
author_rank: Contributor
timestamp: December 16, 2024, 02:43:46 am
content: Quote from: NorthGuy on December 16, 2024, 12:24:39 amSo the truck has 2 native CAN networks, HS CAN (500kps), MS CAN (125kps) and the instrument cluster is the gateway between those two busses. The newer modules run off the HS CAN network but can’t be hooked directly to the trucks native HS network due to incompatible message formatting and possibly sending the same ID and causing havoc on the receiving modules. These modules will listen to whatever info they get on the ID they are looking at, they won’t ignore bogus info and if I try to send the ID with the info the new module wants it will mess up the rest of the trucks native modules.So I need a CAN module for the native HS network, a CAN module for the new HS network, a CAN module for the MS network to translate some IDs to other IDs and a CAN module for a new network called I-CAN (infotainment) network (500kps) that runs all the audio/nav/infotainment information. The I-CAN is needed to keep the network traffic lower on the other busses (If I remember right the native HS bus had over 1000-2000 messages a second and that’s not including scan tool requests).Now why I want one controller is there’s several messages that need to come from the native HS bus and be converted to the new format and transmitted to the new HS and the I-CAN bus, there’s messages that need to go from I-CAN to MS network. I’m really trying to avoid having to make messages to go between microcontrollers that are on different busses to get the info over, as an example: bus1 —> gateway —> gateway—> gateway —> bus3. I want to avoid making new IDs as I don’t know what IDs modules could be looking for (as other non equipped option for the truck could send) and add additional CAN message load on the busses.

author: Postal2
author_rank: Frequent Contributor
timestamp: December 16, 2024, 03:55:35 am
content: Quote from: ifrythings on December 16, 2024, 02:43:46 amI finally understood the deep meaning.video->video-gateway->sound-gateway->sound.240volt->voltage-gateway->water-gateway->water.Grandly.

author: Psi
author_rank: Super Contributor
timestamp: December 16, 2024, 04:37:03 am
content: I've not read this entire thread, so apologies if its already been said, but just FYI Arduino adds a lot of overhead and slows down what the hardware is capable of.Just using ATMega without Arduino and dealing with register calls yourself will make things go faster.Using other peoples Arduino libraries is also a big issue as they can be written badly, and some lag the processor due to hard delays.Failing that, yeah STM32 is where i would go, but it will be a non-trivial learning curve from all the Arduino hand holding.If you want to get STM32 up and running quickly, Visual Studio code + PlatformIO is one option.

author: Chicane
author_rank: Contributor
timestamp: December 16, 2024, 12:30:08 pm
content: You'll not find MCU with more than one CAN in DIL package to be easy to hand solder. Majority of MCUs with 2 CAN controllers are available in 64-pin packages with 0.5mm pitch. Those with 4-6 CAN controllers are 100 or 144 pin packages, LQFP or similar. Cheaper, more accessible and with available documentation are those from STM. Some like STM32F105,407,446 are -40 to 105 C but not AEC-Q100 automotive grade qualified. Automotive grade Microchip MCUs with more than 2 CAN are quite hard to find, but do exist and documentation is available.In terms of reliability, performance and automotive grade, there is no better than NXP in my opinion. It's my first choice, since I do automotive only. Problem is, documentation is not available but they provide some code examples. All their dev boards come with a programmer/debugger, that you can reuse. Those dev boards are not cheap. Don't be surprised when you see $400-500 price tag on them. Look them up on eBay first.To daisy-chain multiple MCUs to get to the desired number of CAN will not be that simple in terms of coding. I suggest to use external CAN controllers like your MCP1525 instead, if you decide to go that route.

author: Chicane
author_rank: Contributor
timestamp: December 16, 2024, 12:43:23 pm
content: Quote from: shtirka on December 14, 2024, 03:03:12 pmThose Aliexpress boards are no good. Genuine STM Nucleo dev boards with break-out ST Link on them are $20 on Amazon with next day delivery.

author: Chicane
author_rank: Contributor
timestamp: December 16, 2024, 01:10:58 pm
content: Quote from: Postal2 on December 16, 2024, 03:55:35 amWhat kind of truck is that? The only IC that serves as a gateway I can think of is the one in VAG cars, so I guess that's what you're dealing with here?You can't translate messages with one ID into messages with a made up ID.As far as I understand, you're trying to retrofit modules from a newer generation of the same model. the IDs are most-likely the same, and new ones are added to the newer model for modules that didn't exist in the old model. but that will have to be confirmed.A great 2-CH CAN adapter compatible with PCAN View and Busmaster is this:https://www.amazon.com/dp/B0CGPRPZN8?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1for $20-30 more you can get the same one with 2x LIN from Aliexpress or Ebay, if youre willing to wait.

author: shtirka
author_rank: Contributor
timestamp: December 16, 2024, 02:49:21 pm
content: Quote from: Chicane on December 16, 2024, 12:43:23 pmAnd what makes you think I will want to listen to an unjustified claim - considering I myself own and have personal experience of 7 (including the two I linked to) STM32 boards from this specific vendor? Not that I actually care much for arguing with you about that

author: Postal2
author_rank: Frequent Contributor
timestamp: December 16, 2024, 07:30:13 pm
content: Quote from: Chicane on December 16, 2024, 01:10:58 pmWhat I meant was that if you use separate filters for different buses, you won't need to transfer data from one filter to another.If we hypothetically assume that the old module was on the fast bus and the new one uses the slow bus, then any attempt at merging would require arbitration, which no one seems to want to do:Quote from: ifrythings on December 14, 2024, 05:45:26 pmThat is, as I have already said, the optimal solution is to use one filter for one added module. Accordingly, you need 2 CAN bus controllers. And 4 or more CAN controllers are needed if you are arbitrating in equipment developed entirely by you personally.Quote from: Chicane on December 16, 2024, 12:30:08 pmThe developers didn't see your advice in time (photo).

author: ifrythings
author_rank: Contributor
timestamp: December 17, 2024, 12:37:44 am
content: Quote from: Chicane on December 16, 2024, 12:30:08 pmMost of the stuff I'm hand soldering is surface mount 0603 size, as long as it has legs (even QFN) i can solder no problem, its the BGA stuff i haven't tried or tooled up for yet.I have only found mostly 1 CAN controller in 8 bit MCU's, 2 CAN controllers in 16 bit MCU's, then the 32 bit stuff has tons of options but also very complex looking MCU's to control.Most of the MCU's I'm finding in the automotive world (2008-2016 era) are Freescale/NXP units, generally 16 bit units with 2 CAN controllers. These are pretty much obsolete and discontinued now.The issue I'm having with the MCP2515 is the lack of filters (5 I believe), which ends up with me having to do the filtering in the cpu. Other issue is the SPI bus, I'm running a 20MHz crystal on the Atmega328P and using the clock out at 20MHz to feed the MCP2515 to get the 10MHz SPI bus speed which is fine for 1 maybe 2 MCP2515's but after that I believe that's becoming my bottle neck/overhead issue trying to go fetch everything from the MCP2515 just to find out I don't need it and discard the info.Going with a MCU with built in CAN controllers will remove the overhead of fetching everything over SPI bus for the CAN controllers, I'm hoping that DMA can take receive buffers and move it to memory till the MCU has time to go through the data and do conversions that are needed.What kind of documentation do you get with NXP chips? I'm able to find some datasheets for chips of theirs out there, the formatting is a bit different and maybe a bit more cryptic but appears to be all there.Quote from: Chicane on December 16, 2024, 01:10:58 pmThe truck in question is a 2008 Ford Superduty. The 2008-2010 era uses, lets call it old CAN message formatting, the cluster is the gateway between the HS and MS bus and also the anti theft system (PATS). Starting in 2011 (to 2016) Ford changed the Superduty to use a new formatting, lets call it new CAN format, that uses a lot of the same ID's but not the same data or encoding in the message ID's. They moved the HS to MS bus gateway and the anti theft system (PATS) to the BCM starting in 2011, in 2013 higher trim levels got fancier options that made Ford add another CAN bus called I-CAN. I-CAN was added and a new gateway between HS and I-CAN bus was put into the cluster and leaving the HS to MS bus gateway in the BCM. I can not run either the BCM or the cluster from the 2011+ trucks as the anti theft system (PATS) wont work, so I need a way to read from the old HS bus, make a new HS bus, make a new I-CAN bus and read/write to the MS bus.In 2017 Ford changed architecture again but made a separate gateway module that has 5 CAN busses going to it, This module is exactly what I need but uses a Freescale SC667303VLH4 MCU that I can not find any info on and according to what I could find, any MCU starting with SC is a custom chip, this one only Ford has info about so that's out of the picture.

author: Postal2
author_rank: Frequent Contributor
timestamp: December 17, 2024, 01:07:43 am
content: Quote from: ifrythings on December 17, 2024, 12:37:44 amWhen I was a little kid, I started building a space rocket in the yard out of plywood.You've taken on a level of difficulty that you can't handle and you don't even realize it.Quote from: Chicane on December 16, 2024, 12:30:08 pmYou will certainly disagree, but for some reason I imagined that you bought this devboard and use it as a coaster for a glass.

author: NorthGuy
author_rank: Super Contributor
timestamp: December 17, 2024, 05:15:44 am
content: Quote from: ifrythings on December 17, 2024, 12:37:44 amHand soldering takes long time. You can save lots of time and effort even with a cheap setup. Order a stencil ($20 USD on JLCPCB including shipping) and paste ($25 on DigiKey). Use vacuum to pick and place ($50 aquarium pump). Buy a toaster oven in Walmart ($40). That's all you need.BGAs are easier than you think.Quote from: ifrythings on December 17, 2024, 12:37:44 amIt is always easier to use internal module than an external component. Less soldering too. PIC32MK has 16 filters per module and 16 corresponding FIFOsAll MCUs are essentially the same. Thinking that one brand is inherently better than the other is fallacy. Smaller ones have less registers and are simpler to set up. Bigger ones have more registers and require more time to figure out. But there's no fundamental difference. If you write in C, it doesn't really matter what CPU you use. Look at periphery instead.

author: uer166
author_rank: Super Contributor
timestamp: December 17, 2024, 06:28:37 am
content: Quote from: Postal2 on December 16, 2024, 07:30:13 pmST SPC5x series is indeed the most popular MCU used by a lot of automakers. The N and E variants have 8 CAN buses and are good for auto gateways.

author: Postal2
author_rank: Frequent Contributor
timestamp: December 17, 2024, 08:05:55 am
content: Quote from: uer166 on December 17, 2024, 06:28:37 amThere is a second MCU STM32F103 nearby. Description of the simplest gateway between two CAN buses, if anyone is interested:Quote

author: ifrythings
author_rank: Contributor
timestamp: December 19, 2024, 05:31:22 pm
content: So I decided to try the SPC582B60E1MH, price isn’t bad for single units, is 5v, automotive approved, has 7 CAN busses, 1K flash and 96K ram. I also ordered the demo board (SPC582B-DIS) that they have examples for so I should be able to get something going fairly quickly.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 22, 2024, 01:26:21 pm
content: Quote from: NorthGuy on December 17, 2024, 05:15:44 amOh, BGAsareeasy. They have relatively large pitch (they can afford it, because pin number scales quadratic to linear dimension) so alignment is not that critical. Balls self-align well during reflow. And most importantly, thinking of side view, the empty space around the balls regulate the amount of excess solder, so stencil apertures and printing process are not that critical.QFN is opposite. It feels like it's somehow "easier" with pins on the edges. But it still doesn't have legs. It shares the limitation of legged parts: pin number increasing only linearly to linear dimension, so higher pitch is needed to enable miniature size, 0.5mm is very typical and even smaller used. And without balls, there is nothing limiting insertion depth physically: when you press it into paste, excess paste squeezes everywhere. Thus balanced amount of solder and insertion in perfect level is important, otherwise some pads do not flow at all (too little solder, and the solder ends up in a small isolated ball under the component).It was kinda interesting to see how much problems I had with some trivially simple and low-cost 20-pin QFN, yet at the same time soldered hundreds of expensive specialty image sensors - chip scale packaged so "no packaging", and a lot of pins, all of which important for operation. Something which many would be afraid of, but 99% success rate even with a crappy amateurish process. But they hadballs!The historical reason for avoiding BGA as hobbyist or small player is that you usually need at least 4-layer board with small vias and small trace sizes to fan-out them. Those used to cost arm and leg, but for past 10-15 years this hasn't been a problem anymore. But there is nothingdifficulteither in design phase or prototype manufacturing either. Now if you had to manufacture your own PCBs then things would be different.

author: Postal2
author_rank: Frequent Contributor
timestamp: December 22, 2024, 01:49:05 pm
content: Quote from: Siwastaja on December 22, 2024, 01:26:21 pmFirst solder the belly with neutral flux NC-559, then wipe the edges, lubricate the edges with active RMA-218 and go over with a drop of solder.