Over. 2 billion stm8 sold - Page 1
Forum section: electronics / general

author: dannyf
author_rank: Super Contributor
timestamp: June 15, 2016, 01:12:14 pm
content: Stm announced earlier in April that cumulative sales of stm8 exceeded 2 billion units. That figure was 1 billion in 2014, for a chip introduced around 2010.Pretty amazing.Um a big fan of stm8s003f4.

author: Kjelt
author_rank: Super Contributor
timestamp: June 15, 2016, 01:15:47 pm
content: It is a good cheap chip and used a lot, not the best architecture/instruction set around but still pretty fast and multi purpose applicable.I use it for all my hobby projects, too bad it did not get the attention like the PIC and Atmel devices did for the hobbieists.Was it only introduced in 2010? I started working with prototypes in 2008... thougt the first series went into production in 2009.

author: dannyf
author_rank: Super Contributor
timestamp: June 15, 2016, 02:00:05 pm
content: You could be right. The stm8s discovery was introduced in 2009 - so the chips before that. I do remember working on cossmic plus stvp then.My interest in it didn't take off until iar came into play - in 2010.

author: coppice
author_rank: Super Contributor
timestamp: June 15, 2016, 02:03:53 pm
content: The STM8 gets into a lot of high volume, but very low price, applications in China.

author: MT
author_rank: Super Contributor
timestamp: June 15, 2016, 02:37:42 pm
content: i vaguely recall ST have a free of charge dev tols suite for STM8 in contrast to STM32.

author: Kjelt
author_rank: Super Contributor
timestamp: June 15, 2016, 02:52:26 pm
content: Quote from: MT on June 15, 2016, 02:37:42 pmYes STVD from their website and than integrate with the free Cosmic C compiler (one year unlimited size free at the moment).Cosmic also has an IDE but I have not used that.

author: Brutte
author_rank: Frequent Contributor
timestamp: June 15, 2016, 03:16:59 pm
content: Quote from: dannyf on June 15, 2016, 01:12:14 pmNo GCCThere are some low cost/limited commercial toolchains but for hobbyists that is a route to nowhere. Good for middle volume.

author: nctnico
author_rank: Super Contributor
timestamp: June 15, 2016, 03:31:06 pm
content: Quote from: Brutte on June 15, 2016, 03:16:59 pmI agree. These kind of 8 bit chips are only interesting for high volume products where you can shell out several $k for a decent compiler and the benefits are there to endure yet another development toolchain. If you are not into high volume products then you better stay clear from these kind of controllers.

author: tszaboo
author_rank: Super Contributor
timestamp: June 15, 2016, 03:38:30 pm
content: Quote from: nctnico on June 15, 2016, 03:31:06 pmIAR supports it. If you program micros for a living, you have IAR, right?2 billion is a big number. Although these micros are cheaper than some logic gates. Considering that Atmel was celebrating the "one micro pro kopf" just recently.

author: nctnico
author_rank: Super Contributor
timestamp: June 15, 2016, 04:14:24 pm
content: Quote from: NANDBlog on June 15, 2016, 03:38:30 pmOfcourse not! I've been using GCC for the past 15+ years for 99% of my microcontroller projects at various employers. If a microcontroller isn't supported by GCC there has to be a bloody good reason for me to use it!

author: Canis Dirus Leidy
author_rank: Regular Contributor
timestamp: June 15, 2016, 05:17:50 pm
content: Quote from: Brutte on June 15, 2016, 03:16:59 pmYou can use SDCC (it support STM8 from version 3.4), but, IIRC, you must write header files (all those "#define REGISTER_NAME *MEMORY_ADDRESS") by itself.

author: dannyf
author_rank: Super Contributor
timestamp: June 15, 2016, 10:02:14 pm
content: For comparison, microchip shipped about 1bn pics per year, and has shipped 10billion pics in its life by one of thee biggest dealers in 2016.

author: Yansi
author_rank: Super Contributor
timestamp: June 15, 2016, 10:41:13 pm
content: Quote from: Brutte on June 15, 2016, 03:16:59 pmAs far as I know, SDCC can compile for STM8.

author: dannyf
author_rank: Super Contributor
timestamp: June 15, 2016, 10:47:29 pm
content: Here is a comparison of vaarious compilers for stm8.http://www.colecovision.eu/stm8/compilers.shtmlI'm happy with my choice of iar.

author: Yansi
author_rank: Super Contributor
timestamp: June 15, 2016, 10:50:23 pm
content: I think IAR is also free up to 8kB today.

author: dannyf
author_rank: Super Contributor
timestamp: June 15, 2016, 10:55:40 pm
content: By 2003, roughly 6 years after its intro, atmel had shipped 500 million mcus.Vs. 2 billion by st.

author: Kjelt
author_rank: Super Contributor
timestamp: June 16, 2016, 07:22:26 am
content: Quote from: dannyf on June 15, 2016, 10:47:29 pmYes if you have the cash to spare or make money with products, IAR would also be my choice esp. if you also do STM32 development.SDCC looks like a nice alternative but a compiler/linker is not a complete toolset nowadays.Googling for ten minutes reveals that there does not seem to be an IDE with incircuit/inline debugger support which would be a dealbreaker for me.I know there are last century alternatives but being used to watch all peripherals, core registers, memory, the assembly instructions and variables while stepping through the code it will be a hard time going back to logging.Hopefully ST will integrate SDCC with their STVD IDE soon (april 2016 release does not mention it) and it would be a great alternative.Or if IAR wakes up and offer a combined STM8/32 full version for non commercial use, priced at around or lower than $500 without support that would be very interesting as well.

author: Brutte
author_rank: Frequent Contributor
timestamp: June 16, 2016, 07:25:34 am
content: Quote from: Yansi on June 15, 2016, 10:41:13 pmWell, the compiler itself is quite far fromtoolchaindefinition.The missing component disqualifying STM8 is the lack of MI debugger and the accompanying middleware.I know of several free STM8 compilers available but withouttoolchainthat is in no way competitive on a hobbyist market. Although I do agree that if you buy 60 reels/year then Cosmic or Raisonance license is not an issue, but then that is not a hobby.

author: true
author_rank: Frequent Contributor
timestamp: June 17, 2016, 04:57:01 am
content: Quote from: Kjelt on June 15, 2016, 01:15:47 pmBest instruction set - probably not, no. And not the easiest. But the design is very reminiscent of 6502, done "right" - being pipelined, extended to support natively some 16 bit operations, have a 24bit PC and instructions for data/program flow over this large linear space, and \more. Of the low register count MCUs I've used, I think this core is pretty well designed. A context switch beast, too.I really wish there was a core-only version of this - I'd love to build a little microcomputer / retro game system out of it.I also wish SDCC was a bit better - the compiler isn't so great with STM8, and there are other deficiencies with the toolchain. IAR does a good job with this core, but...it's IAR :/

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 09:30:49 am
content: Biggest problem I had wth its architecture is the lack of registers, only two (Y and X) , if there were a couple more that would have made a big difference.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 11:21:22 am
content: that's true. the compilers had to implement virtual registers because of that: iar has b0..15, w0..7, e0..3, and l0..3 virtual registers for example. but its simplicity drives that low price, which drives the volume.

author: bazsa56
author_rank: Contributor
timestamp: June 17, 2016, 12:01:50 pm
content: The architecture itself might be a bit hard to use, however overall I really like the chip. So far the peripherals that I used ended up being better then those on an AVR or PIC, the price is cheaper, and you can actually address both the EEPROM and flash through normal data memory. That thing is a huge plus for me, makes programming these chips a bit easier. I also like the stlink much better then the pickit and anything from atmel.I'm using cosmic with stvd. Certainly not the best ide or compiler ever, but usable.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 12:09:37 pm
content: QuoteSTVD is a disgrace to anyone who wrote it, and a representation of ST's software capabilities,They would have been far better off re-adapting one of the common IDEs instead.I thought I read somewhere that ST has stopped its development? win-win for all,

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 12:39:07 pm
content: The oldest STM8 compiler I have is Cosmic 2.2.4, stamped to 12/2007, and document dated 2008. So I think the chip was introduced earlier than that.

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 12:50:04 pm
content: Quote from: dannyf on June 17, 2016, 12:09:37 pmHistory.STVD was already in use for the ST7 and probably (do not know for sure) some family before that.In the ST7 era there was no swim or easy debugger so you simulated the entire chip and peripherals and stvd could do that.When the STM8 came I remember being very upset that the simulator was not correctly implemented but using swim and in circuit debugging it was not necessarySo yeah it is not great and it has its quircks (open a stw it closes the window you have to wait a couple of seconds not knowing what the hell is going on and it appears again), it is slow as is Cosmic but it works fine debugging which is important.Quote from: dannyf on June 17, 2016, 12:09:37 pmNope still new controllers are added, latest build is STVD 4.3.9 from april 2016Quote from: dannyf on June 17, 2016, 12:39:07 pmCosmic already gets the inside info from ST on forehand, so that they have the compiler ready and tested at release. Perhaps some earlier STM8 familymembers were already in the market (automotive perhaps) but I know almost for sure that the S207 series was Beta silicon in 2008.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 01:02:01 pm
content: QuoteMine is 4.3.5, from 2013.Doesn't sound like they are putting a lot of resources into it. Back to iar,

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 01:23:16 pm
content: Ofcourse not the STM8 is a cashcow, they are milking it not investing too much in it anymore.I really wonder if there will (ever) be a next generation 8 bit microcontroller (stm9) even from other vendors or that this was it and they are now pushing customers to the cheapo 32 bitters like the F0 series.Would be a shame (IMO) since a small 8 bitter is an ideal way to start learning embedded programming.

author: bazsa56
author_rank: Contributor
timestamp: June 17, 2016, 01:35:48 pm
content: Yeah, IAR would be much better, but right now we're not in a position to buy one just for this 1 product where we're using it in. STVD is not that bad, certainly not great but usable.Regardless of the IDE and compiler, I'm very impressed with the chip itself. Don't mind the quirky architecture at all. I started using it mainly because of the price, but ended up really liking the chip and I see no drawbacks (minus the architecture, which the compiler handles anyway) to it, while I do see some advantages compared to other 8 bit micros. We expect our product to reach somewhat higher volumes then our other products, but the software inside is relatively simple. Our requirements aren't too specific, any chip that has an active current that isn't crazily high and has a hardare multiplier, plus UART and either I2C or SPI is fine. For this specific application I think the STM8 is a no brainer.

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 01:39:57 pm
content: Just looked for the oldest S207 datasheet I could find in my archive, it is from august 2008, rev4 and it is preliminary.I guess the STM8S1xx series were already on the market by thenQuote from: bazsa56 on June 17, 2016, 01:35:48 pmWatch out for that STM8 I2C peripheral it can bite in some applications and it takes time to work around it and lot's of frustration

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 01:42:11 pm
content: Quoteprobably not, unless ST wants to compete in the low-end with Chinese / Taiwanese clones.The CM0 is really the next "8/16" bit chip.QuoteI agree. Liked the TSSOP20 versions of both STM8 / STM32F0. The STM8 is a little bit pin limited. They really should just get rid of the onboard LDO and consolidated the STM8S and STM8L lines: the minimum voltage for STM8S is too high due to the LDO. To me, the 8L is simply a 8S - the LDO.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 02:08:30 pm
content: QuoteIt is a software problem. Basically those incompetent ST coders failed to clear EV6 in the SPL, as their datasheets clearly demanded. Once you fix that, it is golden.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 02:10:19 pm
content: The "solutions" ST proposed in the cpal drivers basically render the devices unusable: they all evolve around making the i2c the highest priority process -> a low-speed peripheral taking the highest priority process. That's how crazy those guys are.Once you code to the datasheet, you should be fine.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 02:24:00 pm
content: the most amazing thing about the i2c fiasco is that st's own i2c examples would not run on their own hardware. You would think the application teams and the qa teams would have caught that before their distribution.

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 02:26:10 pm
content: Quote from: dannyf on June 17, 2016, 02:08:30 pmI never used the SPL for the STM8But I have to dig into it, I had some problems with hanging clocks in combination with some microchip i/o expander, i wrote both off and used a serial shift register with ultrahigh speedIf you could post some code and the fix, would appreciate it, might be usefull for some future project where I can not get past using the I2C unless I bitbang it.Quote from: dannyf on June 17, 2016, 02:24:00 pmor at least fixed it when the complaints started pooring in the support forum

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 03:06:14 pm
content: "If you could post some code and the fix, would appreciate it, might be usefull for some future project where I can not get past using the I2C unless I bitbang it."Cannot give you the code - it was discovered when I was under a contract so it technically is other people's code but I can give you thee general flow when I get to a real computer later.BTW, I'm only the 2nd person in the world who found the fix. The first person is the datasheet writer. The fix is laid wide open in the data sheet as it provides explicit fix in thee documents. How the SPL code monkeys missed that is beyond me.

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 04:47:23 pm
content: Quote from: dannyf on June 17, 2016, 03:06:14 pmThanks, that would be great, also a direct quote from the datasheet where the issue exactly is located would be ok, then there are also no contractual issues.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 04:49:53 pm
content: No problem. I will show you a picture of the datasheet. Just a little bit later.

author: eck
author_rank: Contributor
timestamp: June 17, 2016, 05:55:52 pm
content: Quote from: Kjelt on June 17, 2016, 04:47:23 pmAs the STM32F1 and STM8 I2C peripherals are basically the same, you can check in either reference manualThe key is the diagram called "Transfer sequence diagram for master transmitter". It explains what to do when - specifically, one gotcha is to clear the ADDR flag in SR1. To clear that flag, you need to read SR2 (STM32) or SR3 (STM8). The STM32F1 reference manual mentions this actually three times for good measure (first in the description of the diagram and then twice in the description of the SR2 register).The other quirky thing with the I2C peripheral is the need to generate the STOP condition three bytes prior to the last byte in multibyte read transfers.However, all of this is pretty clearly explained in the reference manuals, including pictures.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 07:19:11 pm
content: eck got that right.this is from the f1 datasheet, with the ev6 condition highlighted. Essentially, the code in F1 SPL does not follow that.my code, for a i2c block writes, goes like this:1. test for bus condition. if busy, return -1;2. send a start condition;3. load up device address + i2c command;4. clear SR1/SR2 through two dummy reads. you don't even need to read them into anything.5. load up the register address, ........you will need to test conditions along the way and be prepared to handle exceptions. similar operations with read.identical process with STM8, different register names.

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 07:20:53 pm
content: Short of the cpal solutions, any i2c code on those chips that do not follow the protocol above is unlikely to work. and there are quite a few such pieces floating around claimed by their creators to be "working",I wonder if they actually tested their code,

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 07:38:34 pm
content: Ah thanks, I will have to look into that if my code has it.Still what a mess with all those states don't you think, you would expect it could have been made so much simpler, but then as we talked about in the other thread, probably not

author: dannyf
author_rank: Super Contributor
timestamp: June 17, 2016, 07:41:05 pm
content: The best i2c routines I have seen are those done by NXP - fully state machine driven and incredibly easy to add / change exception handling regimes.yes, I think the i2c implementation, both hardware and software, here and on ST chips in general is a mess.

author: Kjelt
author_rank: Super Contributor
timestamp: June 17, 2016, 07:45:45 pm
content: Weird huh, the other peripherals like the timers, dac and uart are fine, no problems what so ever.

author: richardman
author_rank: Frequent Contributor
timestamp: June 17, 2016, 07:56:38 pm
content: Yes, when I coded the I2C routines, I coded using the datasheet rather than the SPL/HAL examples and tested the heck out of them. There are definitely typos etc. in those SPL code!!

author: westfw
author_rank: Super Contributor
timestamp: June 17, 2016, 10:31:48 pm
content: Quotethere's a weak implication here that adding an additional target cpu to IAR is cheaper than buying a whole new compiler.Is that actually the case?The STM8F030 is priced like a low-end 8bit microcontroller. In that area, you don't ALWAYS need a C compiler...

author: nctnico
author_rank: Super Contributor
timestamp: June 17, 2016, 11:04:49 pm
content: Quote from: westfw on June 17, 2016, 10:31:48 pmI recall a project where only one engineer could change the software because my employer at that time was too cheap to buy a compiler so the project was coded in assembly. Using the STM8 ended up costing 10 times more than the savings in part costs and the product was already a kludge with an 8051 controller for the main tasks and the STM8 doing something I/O relatedThere really has to be a compelling reason to use these archaic non-mainstream (=no GCC support) microcontrollers and that is volume volume volume. If that doesn't apply to your projects then by all means don't use these kinds of controllers because they will end up costing way more than the savings in part costs.

author: dannyf
author_rank: Super Contributor
timestamp: June 18, 2016, 12:01:47 am
content: QuoteYeah. As long as you code to the datasheet, it is ok.QuoteYeah. Take a look at STM8S SPL's handling of HSE_Value. Total retards.

author: bazsa56
author_rank: Contributor
timestamp: June 21, 2016, 11:30:42 am
content: I can confirm as well that using the datasheet the I2C works just fine. Just finsihed writing my own routines for it, works quite well actually once you get it worked out. Not using the SPL at all for my project, the STM8 is simple enough to just poke the registers directly.