Author Topic: STM32, ghetto style  (Read 156650 times)

0 Members and 4 Guests are viewing this topic.

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: STM32, ghetto style
« Reply #25 on: August 14, 2014, 02:21:34 am »
The STM8 chips are incredibly inexpensive - I have a few of them on a boat from China at 30 cents apiece (STM8S003F). Very difficult to beat at those price points.
How about a Cortex M0 with 8k flash and 2k SRAM for the same price?
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6576
  • Country: nl
Re: STM32, ghetto style
« Reply #26 on: August 14, 2014, 08:38:16 am »
Biggest problem with the STM8 is the compiler. Cosmic has a 1 yr 32kB free license (sponsored by ST while it lasts) or a 8kB for indefinitly.
Some other compiler farmers also have those small free compiler try outs but nothing substantial.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3339
  • Country: gb
Re: STM32, ghetto style
« Reply #27 on: August 14, 2014, 09:14:12 am »
Biggest problem with the STM8 is the compiler. Cosmic has a 1 yr 32kB free license (sponsored by ST while it lasts) or a 8kB for indefinitly.
Some other compiler farmers also have those small free compiler try outs but nothing substantial.

SDCC supports the STM8, though I don't know what the code generation is like.  The STM8 tends to be overlooked because of the very low price of ARM Cortex parts, but it's a surprisingly fast micro for an 8 bitter.
« Last Edit: August 14, 2014, 09:16:01 am by mikerj »
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6576
  • Country: nl
Re: STM32, ghetto style
« Reply #28 on: August 14, 2014, 09:32:53 am »
The STM8 tends to be overlooked because of the very low price of ARM Cortex parts, but it's a surprisingly fast micro for an 8 bitter.
In present time anno 2014 I agree, probably would also choose the Arm now, but the STM8 is out since 2008 when there were no equally cheap Arm micros.
A minus point of the STM8 I find is the lack of registers, it has only three registers and the compilers used only two of them in the beginning. Also the difference in the memorymap, it has a zero page of 128 bytes RAM that is directly addressable, the other RAM is indirectly addessable, so as a programmer you really must choose the variables you place in the zeropage wisely.
Probably the ARM M0 will take over the 8 bit domain, esp. with companies that already develop for ARM M3/4.
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #29 on: August 14, 2014, 10:53:06 am »
Quote
Biggest problem with the STM8 is the compiler.

True. SDCC offers limited support. I use IAR but even the limited 8K version should be sufficient for a lot of simple tasks.

Its timing is also quite unfortunate.

Quote
Probably the ARM M0 will take over the 8 bit domain,

Agreed.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #30 on: August 16, 2014, 05:48:58 pm »
Here is a STM8L151F3 being debugged by the knock-off stlink - so you see what the stlink looks like in case you are interested.

The user code is identical to those for STM32F030 and STM8S003. Compiled code size on the STM8L is about 300b larger, due to the clock management stuff.

Current consumption is 1.8ma @ 8Mhz, vs. STM8S003's 10ma @ 8Mhz. Very respectable.


================================
https://dannyelectronics.wordpress.com/
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: STM32, ghetto style
« Reply #31 on: August 18, 2014, 01:22:09 am »
This is preposterous! The raw power of the 32b ARM cannot be harnessed with a mere soldering iron, a TSSOP adapter board, and a few wires!

Actually this approach can result in practical application not just science project. Here's the original "ghetto" thread that may have been an inspiration: http://www.rcgroups.com/forums/showthread.php?t=2222027 . An stm32f103 board is built for a dollar and change which can replace a $50 multicopter flight controller when used with a cheap chinese IMU board. Links are provided for Ebay parts.

 

Offline SirNick

  • Frequent Contributor
  • **
  • Posts: 589
Re: STM32, ghetto style
« Reply #32 on: August 19, 2014, 07:30:26 pm »
Here's what I don't get, personally:  You can hack that nasty mess together, or you can spend like $8 to have OSH Park mail you a PCB of the same size, with your custom layout on it.  Certainly the difference between a $1 dev board and an $8 dev board is not make-or-break territory, is it?  A circuit that does anything interesting is going to double the cost anyway, at the very least.

I realize some people like to save every last cent / quid / gil, and others just want to do something with the parts they have in a junk drawer.  That's fair.  Different strokes and all that.  There's something to be said for being industrious enough to get a working circuit out of a scrap heap.  An actual thing you'll use more than once (like a flight controller) is a whole other ball of wax though.  I'm getting to where I debate whether to bother with a breadboard or just order a prototype PCB now.  (That might be because I often don't recover the breadboard from its original test circuit though.)
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: STM32, ghetto style
« Reply #33 on: August 19, 2014, 08:51:57 pm »
An actual thing you'll use more than once (like a flight controller) is a whole other ball of wax though.

As part of the recommendation to start out with an of- the-shelf controller:

Quote
if youre a rank beginner its a good idea to pick up one of these [bona fide originals]. but if experienced or like me have lots of frames and motors kicking around its nice to be able to crank out a half dozen of the cheap tricks for the same price.

It might make sense if we are talking about just one unit. But I've built several of these and have saved hundreds of dollars. Significant if Wifey keeps her eye on your "play" budget like mine does. I suspect the majority browsing here also do so from a hobby viewpoint.
 

Offline Ribster

  • Frequent Contributor
  • **
  • Posts: 250
  • Country: be
  • Electronics prototyper. Design. Prototype. Consult
    • Ash Labs
Re: STM32, ghetto style
« Reply #34 on: August 19, 2014, 10:28:25 pm »
Here's what I don't get, personally:  You can hack that nasty mess together, or you can spend like $8 to have OSH Park mail you a PCB of the same size, with your custom layout on it.  Certainly the difference between a $1 dev board and an $8 dev board is not make-or-break territory, is it?  A circuit that does anything interesting is going to double the cost anyway, at the very least.

I realize some people like to save every last cent / quid / gil, and others just want to do something with the parts they have in a junk drawer.  That's fair.  Different strokes and all that.  There's something to be said for being industrious enough to get a working circuit out of a scrap heap.  An actual thing you'll use more than once (like a flight controller) is a whole other ball of wax though.  I'm getting to where I debate whether to bother with a breadboard or just order a prototype PCB now.  (That might be because I often don't recover the breadboard from its original test circuit though.)

SirNick, i don't think you get the point. I agree with you about the best thing to do when you're serious about a project. It doesn't cost that much money and effort to fab a board.
The cheapness, ease of use and time to blinky of this project is terrific for a beginner. And that's the target audience i think.
dannyf can tackle very complex projects, but chooses to pick this one to lower the bar for beginners.
Hell, a 1$ micro, USB->UART chip and you're up and running. That's very nice for a beginner that just wants to play and get to know the ARM world.
www.ashlabs.be
Design and manufacturing of embedded hard- and software
 

Offline SirNick

  • Frequent Contributor
  • **
  • Posts: 589
Re: STM32, ghetto style
« Reply #35 on: August 19, 2014, 11:44:05 pm »
SirNick, i don't think you get the point.

That seems to be the case. ;)

For comparison, I just whipped these up -- an LPC 81x breakout board with room for ISP and reset pull-ups, plus proper decoupling; and a TTL-to-RS-232 adapter.  The boards and serial parts cost about the same as a TTL serial cable (which I have as well.)  You would have to buy something like that to communicate with a bare MCU anyway.  The Intersil IC and supporting components costs about the same as a MAX232 in DIP alone.

Anyway, not trying to spoil the fun.  I'm all for doing it for the sake of it.  It's just that small prototype PCBs are so cheap now.  ;)
 

Offline Ribster

  • Frequent Contributor
  • **
  • Posts: 250
  • Country: be
  • Electronics prototyper. Design. Prototype. Consult
    • Ash Labs
Re: STM32, ghetto style
« Reply #36 on: August 20, 2014, 12:39:54 am »
SirNick, i don't think you get the point.

That seems to be the case. ;)

Not trying to be the asshole here, was maybe a bit harsher then i intended ;).
But you know what i'm saying..
Nice breakouts btw.
For beginners, everything is new. Starting pcb design with eagle and ordering a pcb is sometimes a whole new world opening..
So yea, so great that you can just download some gerbers, send it to the fab and get onto learning ARM.
Should sell these on tindie ;)
www.ashlabs.be
Design and manufacturing of embedded hard- and software
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4316
  • Country: us
Re: STM32, ghetto style
« Reply #37 on: August 20, 2014, 09:34:29 am »
Some "beginners" don't feel that a project is "real" unless they build it themselves, and have despaired of using ARM chips because they're so "complex and difficult to deal with."  For them, this thread is especially valuable because it's an existence proof that ARMs need not be all that complicated after all.

Other beginners would be a lot better off spending $20-30 and getting a plug&play board like a Launchpad.

The people who seem determined to do things themselves, but clearly don't have the needed background knowledge ("can you build me a bootloader with XXX?  I don't know how to run "make"") drive me a little bit crazy...
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #38 on: August 20, 2014, 10:37:36 am »
Another ST mcu that doesn't have an unique ID is STM32F030F, per its datasheet.

Or does it?

Here is a memory dump from 0x1FFF F7A0. Notice the 12 bytes from 0x1FFF F7AC, highlighted in red? That's the unique ID, :)

If you move over to 0x1FFF F7CC (highlighted in green), you will notice 0x10 (= decimal 16) - that's the flash size in KB.

Again, since those features are "undocumented", use them at your own risk.

================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #39 on: August 20, 2014, 10:38:42 am »
There are quite a few of such "undocumented" features, like EEPROM over 128/256 bytes, or flash size (103 vs. 207).

You can find them all if you experiment with those little devices.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #40 on: August 20, 2014, 10:46:39 am »
Quote
Should sell these on tindie

It has surprised me that no one has attempted to do that: get a pcb that has minimal parts, like decoupling caps, or space for a crystal, a swd header, and put it in dip format.

Parts for maybe a dollar and fully manufactured for $2. You can probably sell it for 3 - 5 dollars + postage and make some money.

With the price of those chips + programmer, and its features, it should do well. Plus, if you put an entire ecosystem together, with an arduino like library, you get those liberal arts types interested and wola, you become an Arduino killer, :)
================================
https://dannyelectronics.wordpress.com/
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6576
  • Country: nl
Re: STM32, ghetto style
« Reply #41 on: August 20, 2014, 11:26:51 am »
There are quite a few of such "undocumented" features,............, or flash size (103 vs. 207).
Maybe I misunderstand but ST provides the exact flash and RAM size for each specific device?
For instance below the difference between a 103ZC with 256kB flash and 48kB RAM and 103ZD with 384kB flash and 64kB RAM?
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #42 on: August 20, 2014, 11:39:30 am »
Quote
ST provides the exact flash and RAM size for each specific device?

I am not sure what ST's strategy is, but you can write / read beyond the specified memory size and still be OK. This could be a strategy (it is cheaper to make just one chip and sell them as different chips at different price points), or it could be QC issues (chips that fail above 32K marked as 32K version and chiphs that fail above 16k marked as 16k version, etc.).

For example, You can try to write / read beyond the specified EEPROM / flash memory limits for your chips and see what happens.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6576
  • Country: nl
Re: STM32, ghetto style
« Reply #43 on: August 20, 2014, 12:08:49 pm »
Ah ok , see what you mean.
Well for ST my guess is definitely: strategy.
You can see that in their Arm32 portfolio (number of chips with different rom/ram sizes) you see they cover with some series the entire playingfield (32k to 1MB) and even till some extent keep the package the same!
Where for example NXP has huge gaps (need bigger ROM you get a different larger package and sometimes even a different core).

What surprises me is that they do not restrict access to those parts, with the STM8 this is not possible to my knowledge, the fuses that configure the final choice are made together with the unique id in the factory just before marking.
 

Offline SirNick

  • Frequent Contributor
  • **
  • Posts: 589
Re: STM32, ghetto style
« Reply #44 on: August 20, 2014, 07:42:04 pm »
Not trying to be the asshole here, was maybe a bit harsher then i intended ;). But you know what i'm saying..

You weren't, and I agreed with you, so no offense taken.  Likewise, I wasn't trying to be critical of the thread itself -- I'm actually really happy someone is taking the time to bring these chips down to the lay-people.  There's a documentation gap in the ARM micro ecosystem, so we need more of this.

Other beginners would be a lot better off spending $20-30 and getting a plug&play board like a Launchpad.

Yeah for sure...  However I think the default dev-board platform contributes to the stigma of complexity.  For one, the Start Here docs tend to pummel you with vendor baggage -- the JTAG and debug parts, recommended IDE, vendor's support site stuffed with more literature than you could possibly read with a year off work and a warehouse full of bran muffins...  Then there's the dev board itself -- essentially a small product of its own, with a random combo of stuff you'll use and some you won't.  Furthermore, they're geared for B2B, working engineers, and selling their unique features.

By contrast, the minimal concept is good -- it illustrates exactly what is essential, and everything else is added to that.  :-+  This thread, and stuff like it, go a long way to introducing new users, who can then ascertain what they need to study depending on what they want to do next.

Nice breakouts btw. ... Should sell these on tindie ;)
It has surprised me that no one has attempted to do that: get a pcb that has minimal parts, like decoupling caps, or space for a crystal, a swd header, and put it in dip format.

I totally agree, however I imagine it would take a while to build a personal fortune on $1-a-board profits  ;), so instead I'm working on contributing some stuff like this to the community.  I bought (another) domain and some cheap web hosting for that purpose.  (There are plenty of forums and stuff already, but I need a stable home for content.)  Working on some PHP infrastructure now, then I need to collect info, test a few PCB designs, and write some guides.  For hardware, a buy-this-PCB link to OSH Park's user contributed store thingy would make it painless to provide easy access to the parts, without having to insert myself into the distribution chain.

The TTL breakout module is designed with this in mind already.  I made it for a BeagleBone Black, with the Logic Supply case that has a DB-9 break-out tab, but it would work in a cable shell too.  The PCB is designed to mount directly to the DB-9, and can be flipped depending on whether you want the device to be DCE or DTE (it only really needs to flip TX/RX and provide a ground pin on both sides).  The Intersil IC even has an Inactive pin that's HIGH when there's a link detected, and LOW when there's not.  That lights an LED on the right side of the header, which makes troubleshooting easy.  Way more than I need, but I thought a few extra features would make it a more useful board for others.

Alright, I'm hijacking this thread now, so ... back to Mr. F.
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #45 on: August 20, 2014, 08:19:29 pm »
Quote
with the STM8 this is not possible to my knowledge

I don't know if that's the case. I will experiment when I get some time.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #46 on: August 20, 2014, 10:10:43 pm »
So we now know that we can at least write through 0x40EF (240 bytes) but fail at 0x40FF (256 bytes)

But we want to push the boundary further and see how many writes we can take between 0x40EF and 0x40FF.

Now, we start to increment the write at 0x01 rather than 0x10.

ie., we are going to write 0xf1 at 0x40f0, 0xf2 at 0x40f1, ...., and 0x00 at 0x40ff.

Here is the memory dump, with relevant cells highlighted in green.

As you can see, we can at least push to 0x40FE. That is, stm8s003F has at least 255 bytes of eeprom, vs. 128 bytes as specified in the datasheet.

Due to data type restrictions, we don't know if we have succeeded in writing to 0x40FF -> we will figure that out later.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32, ghetto style
« Reply #47 on: August 21, 2014, 12:43:42 am »
Quote
It has surprised me that no one has attempted to do that: get a pcb that has minimal parts, like decoupling caps, or space for a crystal, a swd header, and put it in dip format.

Looks like someone beat me to it: there are quite a few such boards on ebay - stm8s003f, voltage regulator, reset switch, isp header, a couple leds and 0.1" dip pin out, plus unfitted crystal.

All for less than $2 shipped. and seems to be fairly popular.

Now, all you need is some kind of arduino-like library and you are off to a great start.
================================
https://dannyelectronics.wordpress.com/
 

Offline neslekkim

  • Super Contributor
  • ***
  • Posts: 1305
  • Country: no
Re: STM32, ghetto style
« Reply #48 on: August 21, 2014, 08:18:05 am »
Looks like someone beat me to it: there are quite a few such boards on ebay - stm8s003f, voltage regulator, reset switch, isp header, a couple leds and 0.1" dip pin out, plus unfitted crystal.

All for less than $2 shipped. and seems to be fairly popular.

Now, all you need is some kind of arduino-like library and you are off to a great start.

Yeah, like these? http://www.ebay.com/itm/171346510522
$3 for two, not bad.
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6576
  • Country: nl
Re: STM32, ghetto style
« Reply #49 on: August 21, 2014, 10:57:04 am »
If you analyze the cost vs profit it is rediculous:
STM $0,40 (in huge quantities)
Capacitors  $0,05
Diodes     $0,03
USB conn  $0,20
header  $0,05
switch $0,05

Total cost without pcb + manufacturing $0,78
Asking price incl shipping $1,50

Let's say they want 15% profit so price would be $1,28

So you have then $0,50 for making a gold plated PCB + manufacturing + envelope + handlingfee + shipping.

No western company can do this  |O
« Last Edit: August 21, 2014, 10:58:40 am by Kjelt »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf