Skip to main content

G0 Beyond the STM32F1

There is more to ST Microelectronics than the STM32F103C8 Microcontroller. They make a variety of sensors, mosfets, gate drivers, diodes,  and just about anything you can think of. However, within their microcontroller line there are an array of options. Typically divided into their respective target market. The famous STM32F1 started being produced in 2007, in technology years..its a dinosaur. 
Nowadays STM offers  better designs that are not only more power efficient but easier to design for. Since 2007 a lot has chanced and STM is producing chips using a more advanced and smaller 90nm process versus the 130nm process in the F1. What that means is that STM is squeezing more transistors into their chips, thus packing more features into them and making them more power efficient. I own an STM32L0 board that I purchased to test some code I was working on for a freelance gig. The freelance work required that I used CubeMx HAL so I did not get a chance to look into the registers. However, recently I was trying to implement a driver for a VL53l0x which uses I2C to communicate with the host mcu. I have never had the need to use I2C as a master receiver in the any of my personal projects, for example and OLED screen uses I2C and the master sends it display data and thats it , there is nothing to receive from it for any practical purpose.  So I found myself trying to program the I2C registers in the F1 to receive  data and boy was it a hassle. There is an entire section on the F1 I2C in the errata pdf.  Ultimately I gave up and gave it a shot on the STM32L0 and I was done in no time.

Not only  does STM32L0 have a much better implementation of the I2C, but the reference manual is much better written and comes with register level sample C code! Which is amazing for newbies and not so newbies alike.  Likewise the new STM32G0 series also offer the same great reference manual like the STM32L0 and better efficiency than an STM32F1. 


For high end applications I am going to start looking into the F4 or F2 series and I will get back to you on that when I get a chance. But for my personal home projects and  tutorials I will address the newer STM32G0 and L0 series. I do understand the attraction of the F1 because they are dirt cheap and readily available for about 3 bucks on a pcb ready to go. But that is a matter of supply and demand, if more people get interested in new chips  you better bet our friends in china will start making those boards with newer chips in no time. I am an engineer in the making and I have to keep up with the times. For example I have never had a single STM32 programming gig where they are using an F1. Its almost always some variant of an L0 for low power or battery operated devices. Think about it, similar performance with way better efficiency. One thing I love about the L0 is that is has on-board EPROM, meaning you can store data such as user settings on that chip and not lose it when the mcu loses power. 
I also have to expand my portfolio by using other vendors. I originally chose STM because when I was starting out their datasheet made more sense to me than all the other ones I tried to read. But now that I have a pretty good idea and understanding how these things work I can definitely tackle a new vendor. Which will most likely be Microchip because of their dominance in the market, specially since the acquisition/merger (not sure which it was) with Atmel. 
Like I have mentioned before I intended on making my own development boards to go along with my tutorials, so shoot me a message if you're interested, it might motivate me to get the project done a lot faster.

Comments

Popular posts from this blog

Interface a Rotary Encoder the right way.

So whilst reading my favorite odyssey found here I stumbled onto something I never spotted before. It turns out that the general purpose timers support hardware interfacing with an incremental encoder. This means no more interrupts and no need to increment whatever variable you had. Now all you have to do is get the value from the Count register in the timer. Did I also mention it takes care of figuring out which direction you are turning it? Amazing! Lets talk about it.






Encoder Interface Mode Verbatim from the reference manual of the STM32F103 page 392 or Section 15.3.12  "Encoder interface mode acts simply as an external clock with direction selection. This 
means that the counter just counts continuously between 0 and the auto-reload value in the 
TIMx_ARR register (0 to ARR or ARR down to 0 depending on the direction). So the user 
must configure TIMx_ARR before starting. In the same way, the capture, compare, 
prescaler, trigger output features continue to work as normal."
W…

STM32L0/F0/F3 I2C : Part 3 RX TX via DMA

Most modern microcontroller come with a peripheral called DMA which allows for an even more hands-off approach. The Direct Memory Access controller will get a tutorial of it's own in the future. However, it is so simple to use that I can easily explain the required bits in this tutorial without feeling like I will overwhelm the reader. In this iteration of the I2C series I will cover how to TX and RX date on the peripheral in conjunction with the DMA controller. 

First let me briefly explain in a high level what the DMA controller does. It allows you to transfer data in 3 ways: Peripheral to memoryMemory to peripheralMemory to memory. What does this mean? For example, when you receive data on I2C in your RXDR register, you can have the DMA controller move that data received into an array. At the end of the day your variables are just memory locations, so if you have declared an array it has an address associated with it, this is address is what the DMA considers  "Memory"…

STM32 I2C Does it suck?

Recently I have been annoyed with  bugs in the I2C implementation in ST's F1/L1/F40/F2 series, and  any microcontroller made by ST before 2012. There appears to be, what I can only describe as, a race condition when attempting to receive data in I2C interrupt(low priority)  or polling mode.





Just to be clear a race condition is defined as , verbatim from wiki: "the behavior of an electronics, software, or other system where the system's substantive behavior is dependent on the sequence or timing of other uncontrollable events. It becomes a bug when one or more of the possible behaviors is undesirable."
I was humming along trying to make my YouTube tutorials when I arrived to the I2C protocol implementation. I have used I2C with the F1 series plenty of times, however I have never had the need to receive data from a slave. However for the sake of completeness I decided to implement an RXing routine in I2C for my tutorial. Only to find statements like this in the referen…