Author Topic: Yet another request for an optimal micro controller  (Read 4015 times)

0 Members and 1 Guest are viewing this topic.

Offline jksTopic starter

  • Newbie
  • Posts: 9
  • Country: nz
Yet another request for an optimal micro controller
« on: February 13, 2019, 11:00:11 pm »
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-based :palm:  But 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.
 

Offline lucazader

  • Regular Contributor
  • *
  • Posts: 221
  • Country: au
Re: Yet another request for an optimal micro controller
« Reply #1 on: February 14, 2019, 12:19:30 am »
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 100
https://www.digikey.com/product-detail/en/microchip-technology/ATSAMD21G15B-MUT/1611-ATSAMD21G15B-MUTCT-ND/6832821

QFN 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
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1574
  • Country: au
« Last Edit: February 14, 2019, 02:30:01 am by PCB.Wiz »
 

Offline ttt

  • Regular Contributor
  • *
  • Posts: 87
  • Country: us
Re: Yet another request for an optimal micro controller
« Reply #3 on: February 14, 2019, 12:31:18 am »
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.html

Documentation and tooling is not the worst I have seen, if not a bit unorganized:

http://gd32mcu.21ic.com/en/index

I 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.
« Last Edit: February 14, 2019, 12:46:43 am by ttt »
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Yet another request for an optimal micro controller
« Reply #4 on: February 14, 2019, 08:34:10 pm »
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.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5059
  • Country: ro
  • .
Re: Yet another request for an optimal micro controller
« Reply #5 on: February 14, 2019, 10:41:24 pm »
pic16f15375 36 io
pic16f15376
pic16f15385 44 io
pic16f15386
up to 32mhz, built in osc etc ...

~1$ in 100+pcs,  ~ 1.2$ in 1pcs

programmer is cheap, like 10-15$, open source programmers are available... architecture is well known etc etc

Can 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 trustworthy

just 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
 

Offline georges80

  • Frequent Contributor
  • **
  • Posts: 912
  • Country: us
Re: Yet another request for an optimal micro controller
« Reply #6 on: February 14, 2019, 11:26:56 pm »
https://www.arrow.com/en/products/stm32f030c6t6tr/stmicroelectronics

100 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.
 

Offline jksTopic starter

  • Newbie
  • Posts: 9
  • Country: nz
Re: Yet another request for an optimal micro controller
« Reply #7 on: February 16, 2019, 06:23:45 am »
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.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Yet another request for an optimal micro controller
« Reply #8 on: February 16, 2019, 09:27:01 am »
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.
For 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.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1574
  • Country: au
Re: Yet another request for an optimal micro controller
« Reply #9 on: February 16, 2019, 09:41:27 am »
... compared to 120 pages for the LP51. ..

If 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 package

AT89LP52-20MU 44 VQFN -40C to +85C Tray (360)  $0.62
AT89LP52-20AU 44 TQFP -40C to +85C Tray (160)   $0.86
AT89LP52-20JU 44 PLCC -40C to +85C Tube (27)  $1.15
AT89LP52-20PU 40 PDIP -40C to +85C Tube (10) $1.44

vs
AT89LP51-20MU 44 VQFN -40C to +85C Tray (360) $0.55
AT89LP51-20AU 44 TQFP -40C to +85C Tray (160) $0.86
AT89LP51-20JU 44 PLCC -40C to +85C Tube (27) $1.15
AT89LP51-20PU 40 PDIP -40C to +85C Tube (10) $1.44

 

Offline cstratton

  • Regular Contributor
  • *
  • Posts: 62
  • Country: us
Re: Yet another request for an optimal micro controller
« Reply #10 on: February 21, 2019, 09:06:12 pm »
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.
« Last Edit: February 21, 2019, 09:08:58 pm by cstratton »
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Yet another request for an optimal micro controller
« Reply #11 on: February 23, 2019, 11:58:19 am »
... compared to 120 pages for the LP51. ..

If 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 package

AT89LP52-20MU 44 VQFN -40C to +85C Tray (360)  $0.62
AT89LP52-20AU 44 TQFP -40C to +85C Tray (160)   $0.86
AT89LP52-20JU 44 PLCC -40C to +85C Tube (27)  $1.15
AT89LP52-20PU 40 PDIP -40C to +85C Tube (10) $1.44

vs
AT89LP51-20MU 44 VQFN -40C to +85C Tray (360) $0.55
AT89LP51-20AU 44 TQFP -40C to +85C Tray (160) $0.86
AT89LP51-20JU 44 PLCC -40C to +85C Tube (27) $1.15
AT89LP51-20PU 40 PDIP -40C to +85C Tube (10) $1.44
I 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.)
 

Offline krho

  • Regular Contributor
  • *
  • Posts: 223
  • Country: si
Re: Yet another request for an optimal micro controller
« Reply #12 on: February 23, 2019, 12:13:01 pm »
The STM32G070,STM32L010 are a bit more than 1$ , however if 8 bit is an option then take a look at STM8 series
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3148
  • Country: ca
Re: Yet another request for an optimal micro controller
« Reply #13 on: February 23, 2019, 02:06:35 pm »
I 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.)

Such 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.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Yet another request for an optimal micro controller
« Reply #14 on: February 24, 2019, 03:31:30 am »
I 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.)

Such 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.
Mutate? Are those additional Flash and RAM useable, or are there faults?

The STM32G070,STM32L010 are a bit more than 1$ , however if 8 bit is an option then take a look at STM8 series
If you are talking prices in China, STM32F030F4P6 can be had for 30 US cents or so.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1574
  • Country: au
Re: Yet another request for an optimal micro controller
« Reply #15 on: February 24, 2019, 03:40:30 am »
I 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.)
Of 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 parts start at 16kF, in MSOP10)
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3148
  • Country: ca
Re: Yet another request for an optimal micro controller
« Reply #16 on: February 24, 2019, 03:41:24 am »
Mutate? Are those additional Flash and RAM useable, or are there faults?

Yes. 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.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Yet another request for an optimal micro controller
« Reply #17 on: February 24, 2019, 05:02:29 am »
Mutate? Are those additional Flash and RAM useable, or are there faults?

Yes. 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.
You might want to document how you did it...

Of 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 parts start at 16kF, in MSOP10)
For 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.
 

Offline jesuscf

  • Frequent Contributor
  • **
  • Posts: 503
  • Country: ca
Re: Yet another request for an optimal micro controller
« Reply #18 on: March 05, 2019, 06:26:13 pm »
I 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.)

It 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!
« Last Edit: March 08, 2019, 05:35:52 am by jesuscf »
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline flydrive

  • Contributor
  • Posts: 12
  • Country: sg
Re: Yet another request for an optimal micro controller
« Reply #19 on: March 05, 2019, 11:19:02 pm »
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 here https://start.atmel.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf