Yet another request for an optimal micro controller  - Page 1
Forum section: electronics / general

author: jks
author_rank: Newbie
timestamp: February 13, 2019, 11:00:11 pm
content: I’ve been through distributor parametric selection (annoyingly incomplete criteria and inconsistent results) and manufacturer product selectors (tedious to use and unreliable pricing). Now I’d like to try the collective wisdom of the forum.Help me find an optimal micro controller please.Requirements:* Bi-directional GPIOs: 36 minimum (or 32 + one SPI on separate pins)* Flash-based. In-circuit programmable (ICP).To be optimized:* Price: Current leader is US $1 Q100.* Package: SMD, but somewhat friendly e.g. QFP/SO, QFN if necessary.* Internal oscillator if possible.* ICP requires no programmer and can be bit-banged (i.e. protocol is disclosed).Don’t care:* uC speed as long as > 1 MHz.* uC architecture or flash program capacity. My program will only be a few dozen instructions long.* No program development tools required (dev env, compiler, assembler etc.)The current leader is a Microchip AT89LP51. Yes, 8051-basedBut that part is dead-simple and familiar. It’s perfect: TQFP-44, 33 GPIOs + ICP/SPI, 1.8 MHz internal osc, no other junk to get in the way. I need to emulate a function similar to a 74LVT18512 (discrete boundary scan chip). But without it costing $6 a pop as I will need many of these. Also, I don’t care about JTAG compatibility & speed.Can anyone beat the AT89LP51 at $1?Thanks.

author: lucazader
author_rank: Regular Contributor
timestamp: February 14, 2019, 12:19:30 am
content: Usually an STM32 guy, but yes for your requirements they are all too pricey.Quite a few of the Microchip(atmel) ATSAMD21 chips can be had for less than $1 on digikey.Example: this one is about $0.74 usd in QTY 100https://www.digikey.com/product-detail/en/microchip-technology/ATSAMD21G15B-MUT/1611-ATSAMD21G15B-MUTCT-ND/6832821QFN packages, Flash based, Plenty of GPIO and peripherals, Internal oscilator.Can be programmed with the SWD protocol, which as far as I am aware has open source implementations, and the protocol documentation for SWD is available.Or there are plenty of cheap programmers for this chip that are available.Development wise, normal gcc-arm-none-eabi with makefiles work fine with it.But understandable if you don't want to jump up to an arm chip

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 14, 2019, 12:24:59 am
content: The LP51/LP52 is quite good, on a cents per io basis.Another option could be the N76E616 ~ 59c/100https://lcsc.com/product-detail/NUVOTON_N76E616AL48_C90833.htmlhttps://direct.nuvoton.com/en/n76e616al48or this 42c/100https://lcsc.com/product-detail/STC_STC8F2K16S2-28I_C127322.htmlor this 59c/100https://lcsc.com/product-detail/Microprocessor-Microcontroller_Sinowealth-SH79F1611U_C182003.htmlor this 45c/10https://lcsc.com/product-detail/Microprocessor-Microcontroller_Shenzhen-SinOne-Microelectronics-SC92F7446P44R_C221398.htmlor this 48c/100https://lcsc.com/product-detail/Others_Shenzhen-SinOne-Microelectronics-SC92F7447BP48R_C221399.htmlYou may need to dig to compare the loader choices for those.Nuvoton parts have English data and Eval boards / USB dongle type programmers.

author: ttt
author_rank: Regular Contributor
timestamp: February 14, 2019, 12:31:18 am
content: If you are willing to take the risk of dealing with dodgy sellers, there is the GD32F103C8T6. $.89-$1.09 a piece for a Cortex-M3 chip, on aliexpress. Total overkill for your application but it seems to fit all your needs.LQFP48, internal oscillator, 37 I/O, 64K Flash (ICP over UART and runtime programmable), 20K RAM.https://www.aliexpress.com/item/20PCS-GD32F103C8T6-GD32F103-C8T6-LQFP-48-Best-quality/32952176933.htmlDocumentation and tooling is not the worst I have seen, if not a bit unorganized:http://gd32mcu.21ic.com/en/indexI did not see the protocol for ICP programming being documented, but sniffing the UART traffic to see what it does should be easy. I doubt it's encryped/obfuscated.Update: The GD32F130C4T6 model might be an even better match. $.74 a piece on findchips.com and 39 I/O pins.

author: technix
author_rank: Super Contributor
timestamp: February 14, 2019, 08:34:10 pm
content: STM32F0 series can be a good idea for your purpose here.It is a little bit restrictive here since you don’t have a programmer for any chips, preventing you from using some honestly fairly good chips like a lot of ARM and AVR.If you can not buy one including a clone for some reason, it is possible to build a J-Link v8 or J-Link v9 clone from reversed engineered schematics and burn firmware into it using only your computer and a USB cable. That will give you at least a working JTAG/SWD programmer for ARM based chips, plus PIC32 and EFM8 if you built a v9 clone. Similar for a STM32F072-based J-Link OB clone. If you allow a serial cable be used for initial firmware programming you can also build clone of ST-Link/v2.You can buy a ready-made Arduino board or its various clones, which can be programmed into acting as a programmer for other AVR chips.

author: mariush
author_rank: Super Contributor
timestamp: February 14, 2019, 10:41:24 pm
content: pic16f15375 36 iopic16f15376pic16f15385 44 iopic16f15386up to 32mhz, built in osc etc ...~1$ in 100+pcs, ~ 1.2$ in 1pcsprogrammer is cheap, like 10-15$, open source programmers are available... architecture is well known etc etcCan probably find cheaper 8051 based chips, or ARM based chips even from Microchip... but if the code inside is so basic maybe you don't want to bother with writing loads of code and have bootloaders in your chip just to do that functionality.You could also check sites like lcsc , there are some brands that may be relatively trustworthyjust at a random search, here's an example that may work ... holtek HT32F52241 arm cortex m0, up to 40mhz, 0.7$ in 100pcs but 3.6v max.https://lcsc.com/product-detail/HOLTEK_HT32F52241_C97214.html?manu_id=812

author: georges80
author_rank: Frequent Contributor
timestamp: February 14, 2019, 11:26:56 pm
content: https://www.arrow.com/en/products/stm32f030c6t6tr/stmicroelectronics100 piece about 62 cent. Not 5V compatible though.programmer dongles cost less than a pizza (even cheap ones in the US)In reality there's lots of candidates out there... You would need to be a bit more specific on the electrical compliance specs to narrow things down.cheers,george.

author: jks
author_rank: Newbie
timestamp: February 16, 2019, 06:23:45 am
content: Thanks everyone. I see now why the ATSAMD21 didn’t show up in my parametric searching at DigiKey. Nice part. I have no objection to ARM at all. I’ve used the SAM7X in the past.One problem with the D21 is that the manual is 1200 pages long compared to 120 pages for the LP51. So it takes a while to determine if the part can really do what you want without some fatal limitation. There appears to be some open source code for flashing via the SWD interface. Hopefully that isn’t too much of a headache. I don’t want to use a device programmer to keep things simple for the factory. I will have more than a dozen of these uCs on my board all connected to a small applications SBC plugged onto the board. The SBC does board flashing and functional test and provides a nice web interface for the factory.STM32F030C6T6TR: That pricing from Arrow is great. But it’s also a mistake. A drop by 50% at Q100 from Q25? I don’t think so. Unless they’re trying to dump stock. The STM32F030C6T6 (same thing without tape & reel designation) is $1.17 Q100 which makes more sense. This reminded me to use Octopart.com for comparisons across distributors. It has improved greatly since I used it a few years ago to price an entire BOM.

author: technix
author_rank: Super Contributor
timestamp: February 16, 2019, 09:27:01 am
content: Quote from: jks on February 16, 2019, 06:23:45 amFor ARM chips peripherals needed to be enabled before it would respond to anything. Thus you just need to focus on what peripheral you need for your task and leave everything else disabled. A disabled peripheral have its clock gated off and often no power either. Microchip also included the full-detail ARM CPU core manual as part of the datasheet, which often you do not need for your purpose since you are very likely using a compiler like GCC. Given your task the functional part of the manual can be as little as a few hundred pages or less.As of suppliers, we just came out of Chinese New Year with the global supply chain restarting. Stock dumping can happen if Arrow anticipated orders during the supply chain halt and built up stock to combat uncomfortable leading time, yet the anticipated orders did not come and they have to dump that stock.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 16, 2019, 09:41:27 am
content: Quote from: jks on February 16, 2019, 06:23:45 amIf the LP51 is on a short list, you might want to include the LP52, as an 'alternate source/BOM' ?- Microchip have a strangely package-skewed price on these LP51 variants, but do show the 8k LP52 == 4k LP51 price, for all but VQFN packageAT89LP52-20MU 44 VQFN -40C to +85C Tray (360) $0.62AT89LP52-20AU 44 TQFP -40C to +85C Tray (160) $0.86AT89LP52-20JU 44 PLCC -40C to +85C Tube (27) $1.15AT89LP52-20PU 40 PDIP -40C to +85C Tube (10) $1.44vsAT89LP51-20MU 44 VQFN -40C to +85C Tray (360) $0.55AT89LP51-20AU 44 TQFP -40C to +85C Tray (160) $0.86AT89LP51-20JU 44 PLCC -40C to +85C Tube (27) $1.15AT89LP51-20PU 40 PDIP -40C to +85C Tube (10) $1.44

author: cstratton
author_rank: Regular Contributor
timestamp: February 21, 2019, 09:06:12 pm
content: In terms of bit-bang programmers, OpenOCD for Arm Cortex SWD and similar will run fairly well via the GPIOs on a Raspberry Pi, and that could probably be ported to a different SBC with good direct I/O access if you won't want to be providing spare SD cards to support pis used on a manufacturing line. But you can also do it with a USB-enabled MCU running something like the CMSIS DAP firmware as a bridge if you want to build it right into a test harness board - next time I might look at using pyocd rather than running openocd as a subprocess. And many of the parts have serial bootloaders you can access at the cost of one mode pin.The gd32f103 is so drastically similar to the STM32's that at least the open source STM32 programming tools will work with at most minimal adaptations that were figured out and written up some time ago. Never used one in an original design, but reflashing one in a tiny toy drone was fairly straightforward after digging up some flash option byte stuff.

author: technix
author_rank: Super Contributor
timestamp: February 23, 2019, 11:58:19 am
content: Quote from: PCB.Wiz on February 16, 2019, 09:41:27 amI have the feeling here that the LP51 uses the same die as LP52, just a worse bin (e.g. chips with some failed Flash cells can have half its Flash disabled and sold as LP51, instead of being trashed.)

author: krho
author_rank: Regular Contributor
timestamp: February 23, 2019, 12:13:01 pm
content: The STM32G070,STM32L010 are a bit more than 1$ , however if 8 bit is an option then take a look at STM8 series

author: NorthGuy
author_rank: Super Contributor
timestamp: February 23, 2019, 02:06:35 pm
content: Quote from: technix on February 23, 2019, 11:58:19 amSuch approach must be common. I had a case where PIC18 suddenly mutated into a different part with twice as much flash, more RAM etc. It even changed the device Id. Apparently, the same die.

author: technix
author_rank: Super Contributor
timestamp: February 24, 2019, 03:31:30 am
content: Quote from: NorthGuy on February 23, 2019, 02:06:35 pmMutate? Are those additional Flash and RAM useable, or are there faults?Quote from: krho on February 23, 2019, 12:13:01 pmIf you are talking prices in China, STM32F030F4P6 can be had for 30 US cents or so.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 24, 2019, 03:40:30 am
content: Quote from: technix on February 23, 2019, 11:58:19 amOf course, and I doubt it is even a 'worse bin'.This is done to give MCU vendors some options to lower price, without affecting margins on larger code-projects.The prices signal which one they want you to buy.Given pretty much all new 8051 parts are released now with 16k, (or sometimes 8k), a 4k sizing is antiquated. (newest Nuvoton ML51 series partsstartat 16kF, in MSOP10)

author: NorthGuy
author_rank: Super Contributor
timestamp: February 24, 2019, 03:41:24 am
content: Quote from: technix on February 24, 2019, 03:31:30 amYes. I was working on software which programs it through ICSP, I did something wrong during bulk erase, and suddenly it became a different chip. All the flash was functional. I was able to program and verify it all.

author: technix
author_rank: Super Contributor
timestamp: February 24, 2019, 05:02:29 am
content: Quote from: NorthGuy on February 24, 2019, 03:41:24 amYou might want to document how you did it...Quote from: PCB.Wiz on February 24, 2019, 03:40:30 amFor the chips that went into LP51 packages, there will be untested RAM and Flash, and there might be undiscovered faults if you force into that range.

author: jesuscf
author_rank: Frequent Contributor
timestamp: March 05, 2019, 06:26:13 pm
content: Quote from: technix on February 23, 2019, 11:58:19 amIt could be. I know Phillips/NXP did something similar for the P89LPC935 and the P89LPC925. The P89LPC925 was not supposed to have extended RAM, but it did. It was just a repackaged P89LPC935!As for the AT89LP51 and AT89LP52 I doubt it, because the external memory bus will be enabled for different program counters (4k or 8k). But who knows, maybe there is a secret switch somewhere...In another note, I got some SAMD21 ICs as someone suggested in this thread, just to play with them. So far, figuring out how to program the flash using SWD has been a bit challenging!

author: flydrive
author_rank: Contributor
timestamp: March 05, 2019, 11:19:02 pm
content: I've used the SAMDxx in lots of projects, keep checking others but coming back to that series, they're very capable and cheap. D11 for really small projects, D21 for something needing a bit more beef.If you're messing about with them the easiest start is to pick up the SAMD11 or SAMD21 eval boards, they're not that expensive and have everything built and broken out. Mine have paid for themselves over and again getting projects debugged easily before spinning up boards.I think a lot of people still use the old ASF framework, which has a bit of a learning curve. If you've not seen it before, Atmel Start was/is their latest SDK which I feel a lot of people never heard about. With that you can run up a design on the web interface, including clocks and pin assignments and some functional blocks of peripheral code. That deals with a load of boiler plate setting up clocks and programming pin registers, the code is cleaner than ASF, you see any pin or resource conflicts and has been a good starting point for several projects. You can find it herehttps://start.atmel.com/