Author Topic: PIC32MX vs STM32L4, my first impression  (Read 10842 times)

0 Members and 1 Guest are viewing this topic.

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: PIC32MX vs STM32L4, my first impression
« Reply #25 on: August 04, 2018, 02:18:36 am »
Gimme some STM32 any day. Open tools, good peripherals, excellent documentation, great support, and my ARM chops are easily transferable to any number of other vendors, although I very much prefer and recommend STM32 over NXP. I've also played a bit with the off-brand ARMs such as GigaDevice and Nuvoton, but their peripherals and documentation are very poor comparatively speaking.

I'd love to hear why you prefer PICs, Chacon son gout and all that stuff notwithstanding...

yes it's very funny.

just the fact that you mention that
Quote
my ARM chops are easily transferable to any number of other vendors
makes me wonder if you are serious.
peripherals aren't interchangeable between vendors. In the case of STM they aren't even interchangeable between -some- families. You'll have to rewrite the code anyway, the lie that ARM was interchangeable between vendors so it was easier to migrate from one family to another was just a lie.
ST is by far the worst in this aspect. ATMEL, NXP and any other vendor is more consistent in peripheral configuration and libraries, microchip is the most consistent i could find. A project was ported from dsPIC to PIC32MX in mere minutes, everything was the same. only the atomic writes to registers such as interrupt flag clear were rewritten.

Then STM documentation is by far the worst i've ever had to read. Incomplete, information scattered between part datasheet, peripheral manual, library manual, library example, errata and forum. For example, if you set up SPI by following the reference manual it won't work. the HAL initialiation function -which will work- has a slightly different sequence for peripheral initailizaition.

Then ST Link was no better than ICD or even PK3, Eclipse based IDEs were always a thorn in my foot. A pain to work with.
i can't comment on IAR or Keil of course, but i like MPLAB X waaaaaaaay better than any free IDE based on eclipse or visual studio.

propertary compilers? hello? XC16 and XC32 are GCC. the stupid "license" is bypassed with a simple txt file (kudos to the EEVBLOG member who found out how to bypass the license without patching the compiler) but still, comparing -Os with -O1 (which is available on the free version), the negligible performance improvement in -Os is outshadowed by the easier debugging offered by -O1. very critical sections are always assembly anyway.

the only peripherals that are better on STM are FSCM and MIPI. the rest? microchip is probably the most flexible... in the ADC, DMA, PWM, CLC, almost anything. Everything is reroutable, everything interact with each other in order to offload the core from moving bytes around and setting bits that could and will be set in hardware.

the parts? a STM32 with the same peripherals than a dsPIC will cost at least the same, if not more. It will give me a lot more headaches because of crappier documentation.
Also, i can get a dsPIC with 15 IC and 15 OC, USB, dual CAN  and a bunch of PWMs which i will all use. find a STM32 part that has all of that, for less than double the price. and that in a real world scenario has the same performance. i don't expect an answer because i couldn't find it.
 
The following users thanked this post: Sal Ammoniac, Karel, MT

Offline Muxr

  • Super Contributor
  • ***
  • Posts: 1369
  • Country: us
Re: PIC32MX vs STM32L4, my first impression
« Reply #26 on: August 04, 2018, 02:24:25 am »
Every time I start looking into NXP parts I get lost in their model numbers. Dunno if it's because I am just more familiar with STM32 or if it's because NXP has a lot of legacy and FreeScale parts in their portfolio. STM32 product line up and model numbers just make much more sense.
 

Offline MT

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: aq
Re: PIC32MX vs STM32L4, my first impression
« Reply #27 on: August 04, 2018, 03:43:43 am »
ST is as entangled, no better there, to many variants on the same theme. 1k sram more there 1k less flash there and vice versa. ST docs is just hilariously bad. Thats why i use ST F4 products! :)
« Last Edit: August 04, 2018, 03:49:17 am by MT »
 

Offline KarelTopic starter

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #28 on: August 04, 2018, 06:53:15 am »
that's why why i keep getting back to PICs.

It's funny how things work out -- I started out on PICs and charge a premium to have to work with them these days. Shit IDE, proprietary compilers, terrible debugger environment... ugh.

I'd love to hear why you prefer PICs, Chacon son gout and all that stuff notwithstanding...

We are not a big company and we can not foresee and buy in advance all the key components of our projects.
So, the fact that Microchip doesn't suddenly stop producing one of our key components is a big advantage for us.

So far, I found the Microchip documentation better than STM, but this is personal and is probably also dependent on what you are used to.

I don't understand your complaints about the Mirochip development tools. For pic32 (which is the topic of this thread) they use Netbeans & GCC while STM uses Eclipse & GCC (STM Workbench).
No difference here. I use whatever optimization I want, no need to buy a license, it's opensource (GPL).
I don't know about the quality of the debugger tools, I never use them.
What is nice about STM32 is the cheap devkits and programmer, but pay attention, these cheap programmers are not intended for production use.

What I don't like about Microchip is the pic32mz series, they have so many hardware bugs, it makes them practically useless.
Which is why we still use the pic32mx series.

oh, another thing I'm missing with STM32: shadow registers for fast context switching for high priority interrupts...
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: PIC32MX vs STM32L4, my first impression
« Reply #29 on: August 04, 2018, 07:19:49 am »
What I don't like about Microchip is the pic32mz series, they have so many hardware bugs, it makes them practically useless.
Which is why we still use the pic32mx series.
The first ones were bad but later ones are a lot better.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: PIC32MX vs STM32L4, my first impression
« Reply #30 on: August 04, 2018, 07:37:16 am »
Every time I start looking into NXP parts I get lost in their model numbers. Dunno if it's because I am just more familiar with STM32 or if it's because NXP has a lot of legacy and FreeScale parts in their portfolio. STM32 product line up and model numbers just make much more sense.
Actually it is pretty simple. They have a couple of lines (indicated by the first 2 digits) and once you have selected a line you can look for suitable parts. It is a pity you got stopped by that because I looked at the STM32 parts a couple of times (and even did a board) but the NXP LPC series just works better for me.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline aandrew

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: ca
Re: PIC32MX vs STM32L4, my first impression
« Reply #31 on: August 08, 2018, 02:56:59 pm »
just the fact that you mention that
Quote
my ARM chops are easily transferable to any number of other vendors
makes me wonder if you are serious.

You're of course right in that peripherals are not transferable between vendors. I was speaking more specifically about the architecture itself. My ability to debug and understand Cortex devices (and even "common" peripherals like NVIC) are transferrable between vendors. The debug interface (ETM/ITM if available) is also pretty standard, although admittedly it's very, very infrequent that I have to dig around in there.

Quote
In the case of STM they aren't even interchangeable between -some- families. You'll have to rewrite the code anyway, the lie that ARM was interchangeable between vendors so it was easier to migrate from one family to another was just a lie.

I don't find this at all. Anyone claiming that the peripherals are vendor-agnostic is a damned liar for sure, but I don't think I've heard anyone seriously claim that.

Quote
ST is by far the worst in this aspect. ATMEL, NXP and any other vendor is more consistent in peripheral configuration and libraries, microchip is the most consistent i could find. A project was ported from dsPIC to PIC32MX in mere minutes, everything was the same. only the atomic writes to registers such as interrupt flag clear were rewritten.

I won't argue that ST has had some issues between families (STM32L vs STM32F) but I really do think you're blowing it out of proportion. MOST of their peripherals are code compatible, and that has also gotten better as the family matures. There's almost no difference between peripherals between STM32F and H, for instance, and even *most* peripherals between F and L. There absolutely are some gotchas but they aren't very common.

It's been my experience that devices which are pin compatible are also code compatible.

Quote
Then STM documentation is by far the worst i've ever had to read. Incomplete, information scattered between part datasheet, peripheral manual, library manual, library example, errata and forum. For example, if you set up SPI by following the reference manual it won't work. the HAL initialiation function -which will work- has a slightly different sequence for peripheral initailizaition.

This is my exact argument with Microchip's documentation. I can't stand it. Nordic's is way worse, and NXP's somewhere between Microchip and STMicro IMO. I think that TI takes the cake when it comes to bad datasheets though, and Microchip appears to be taking notes from TI when it comes to "Let's publish each chapter as a separate file". This isn't the day of 2400 baud modems anymore. Give me one 3000 page reference manual and let me at it.

My biggest gripe with the STMicro docs is that the pin muxing is up at the front of the datasheet, and the peripheral documentation is in the RM. I wish the muxing were duplicated in the RM, but understand the demarcation point.

As far as HAL documentation -- I've never ever looked at it. It's horrible. For someone not familiar with HAL it's by far the worst part of it. With experience I understand how the naming and call conventions work, and for anything more specific I literally look at the source. I do *not* claim that this is a good thing, but it is fast once you understand the library.

Quote
Then ST Link was no better than ICD or even PK3, Eclipse based IDEs were always a thorn in my foot. A pain to work with.
i can't comment on IAR or Keil of course, but i like MPLAB X waaaaaaaay better than any free IDE based on eclipse or visual studio.

STLink is garbage. JLink all the way. I fought against JLink for a long time because it was closed and proprietary but man it's nice to have a system that just works. I hate IDEs as a general rule, and Microchip practically forces you to use their Eclipse/netbeans/whatever based garbage.

Quote
propertary compilers? hello? XC16 and XC32 are GCC. the stupid "license" is bypassed with a simple txt file (kudos to the EEVBLOG member who found out how to bypass the license without patching the compiler) but still, comparing -Os with -O1 (which is available on the free version), the negligible performance improvement in -Os is outshadowed by the easier debugging offered by -O1. very critical sections are always assembly anyway.

-Og is ideal for debugging. I'm aware that Microchip uses a closed fork of gcc for xc16 and xc32, which is my complaint about it. You're selling me the chips, you don't need to make money off me for the tools as well. 100% agreed on critical sections being assembly.

Quote
the only peripherals that are better on STM are FSCM and MIPI. the rest? microchip is probably the most flexible... in the ADC, DMA, PWM, CLC, almost anything.

I think the peripherals are comparable, and on the parts with DMA most of these tasks can be automated with very little or no CPU overhead at all. This is actually one area where Nordic has them all beat: Peripherals generate events and accept tasks, and another peripheral called the PPI can be used to connect any event on any peripheral to any task on any other peripheral; the CPU can be completely shut down and asleep for a long time. Some peripherals have internal "short circuits" (Nordic's term) to connect an event from a peripheral back to a task on the same peripheral as well.

STMicro has a lot of this same inter-peripheral functionality between their timers and other peripherals, and IMO their timers are one of the best implementations I've come across on any MCU, almost to the point of being overwhelming to configure.

Microchip has come a long way in terms of pin muxing, way better than ST for sure; Only Nordic and Cypress have them beat as far as I'm concerned.

Quote
the parts? a STM32 with the same peripherals than a dsPIC will cost at least the same, if not more. It will give me a lot more headaches because of crappier documentation.

Also, i can get a dsPIC with 15 IC and 15 OC, USB, dual CAN  and a bunch of PWMs which i will all use. find a STM32 part that has all of that, for less than double the price. and that in a real world scenario has the same performance. i don't expect an answer because i couldn't find it.

on an STMicro, 30 timer channels for capture and compare would have to be done with 7 or 8 timers, depending on specifics. Adding PWM on top of that would increase the timer count as well. Perhaps dsPIC's archtecture has more channels per timer, but USB and dual CAN is hardly difficult to find in their product family. My use cases are generally more about simultaneous ADC, usually with CAN or ethernet and some IC/OC/PWM. A quick look at the dsPIC family seems to indicate that it's all 16-bit data path and significantly smaller amounts of RAM compared to even the smallest STMs.

At the end of the day everyone's got their own favourites and priorities. I am happy that you took the time to write about yours. I enjoy learning about others' experiences. No vendor's perfect and I appreciate the candid discussion. :-)
 
The following users thanked this post: JPortici

Offline gasmeter

  • Contributor
  • Posts: 25
  • Country: gb
Re: PIC32MX vs STM32L4, my first impression
« Reply #32 on: August 15, 2018, 11:21:05 am »
Hi

I changed over to pic32mx's a couple of years ago.
I agree about the pic tools but I used the Mikroe compiler and programmer.

In fact I program in both C and pascal on the Pic.

I don't think its the chip that matters, its the toolchain.
I chose microchip because of the wide range and long production life not for any particular features.


Peter

 

Offline Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: us
Re: PIC32MX vs STM32L4, my first impression
« Reply #33 on: August 15, 2018, 11:17:01 pm »
I've also played a bit with the off-brand ARMs such as GigaDevice and Nuvoton, but their peripherals and documentation are very poor comparatively speaking.

Have you looked at the Infineon XMC series? Nice peripherals and the documentation is reasonable.
Complexity is the number-one enemy of high-quality code.
 

Offline KarelTopic starter

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #34 on: October 31, 2019, 11:38:13 am »
Here's an update about my adventures in starting to learn to program and use the STM32L4 MCU's.
The longer I work with them, the more I like them. I already passed the point that I don't want to go back to PIC32 anymore.
In the end, I don't use an IDE anymore, just my favorite texteditor and a console. Compiling and programming is lightning fast compared to pic32.

I finished a project with an STM32L4 mcu (a portable device) that continuously digitizes three sensors (each at 1KHz samplerate) and
stores the data on a microSD-card and it lasts more than 48 hours using one AAA-battery.

I managed to do this without using the HAL, just the CMSIS header files. I use CubeMX to quickly check the clock and PLL settings but I don't use it to generate code.

So, my conclusion is that starting with STM32 (or probably with ARM MCU's in general) is difficult but if you are willing to take the time to learn, it's a very good investment.
I'm glad I had the change to invest this time and finished successfully this project.
I'm now playing with a NUCLEO-F439ZI  :-+  The goal will be to implement LwIP (Lightweight TCP/IP-stack).
For mcu's, I always write my own libs and drivers but that stops at TCP/IP and USB. Life is too short for that...
 
The following users thanked this post: nctnico, Siwastaja, Jacon

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #35 on: October 31, 2019, 12:23:00 pm »
.
« Last Edit: August 19, 2022, 02:33:40 pm by emece67 »
 

Offline KarelTopic starter

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #36 on: October 31, 2019, 12:41:15 pm »
I managed to do this without using the HAL, just the CMSIS header files.

I'm curious. Just cmsis-core or, also, cmsis-driver?

I guess you mean "device" instead of "driver"?

No drivers, just CMSIS->core and CMSIS->device. But in the case of STM32, they are all header files.

The "device" header files are actually three files, for example: stm32f4xx.h, stm32f439xx.h, system_stm32f4xx.h


 

Offline AE7OO

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: PIC32MX vs STM32L4, my first impression
« Reply #37 on: October 31, 2019, 03:37:56 pm »
In the (far)past I used various PIC's, but not in the last 3 or 4 years.  Now I'm mostly STM32 with a scattering of Nordic parts here and there.  I find the programming much easier(gcc/g++ & make) and then using a Black Magic Probe to flash it.

As far as USB and a IP stacks goes, I would check out ChibiOS's support.
I'm lazy so I just use RT as a foundation and then tack the various parts on. 8)
I think it took me maybe an hour or two total to get USB support added to program I had running on a blue pill(STM32F103).   I use it for the virtual com port, but there quite a few interfaces available.

If nothing else, the ChibiOS HAL is head and shoulders above the "official" one... :D
Oh, a link might help... http://www.chibios.org/dokuwiki/doku.php
 

Offline Jacon

  • Regular Contributor
  • *
  • Posts: 50
  • Country: pl
Re: PIC32MX vs STM32L4, my first impression
« Reply #38 on: October 31, 2019, 03:57:13 pm »
...
If nothing else, the ChibiOS HAL is head and shoulders above the "official" one... :D
Oh, a link might help... http://www.chibios.org/dokuwiki/doku.php

+100 definitely  :-+
 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #39 on: October 31, 2019, 06:11:44 pm »
.
« Last Edit: August 19, 2022, 02:33:58 pm by emece67 »
 

Offline KarelTopic starter

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #40 on: November 01, 2019, 08:18:22 am »
No, I mean CMSIS->driver, that included in the DFP file for the stm32l4xx family. It contains both .c & .h files and, well, they implement drivers.

I never heard of a DFP file. What is it and where can I find it?

I started with system workbench from openSTM32.org. From that installation I copied the CMSIS files.
Later I discovered that it's included in STM32CubeMX.
And recently I discovered that you can simply use git and get the latest version here:

https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Drivers/CMSIS

Thanks
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: PIC32MX vs STM32L4, my first impression
« Reply #41 on: November 01, 2019, 09:56:47 am »
I was under the impression that CMSIS-Drivers was pretty much a failure.  The API seems weird, not enough vendors implement any of it (a chicken-and-egg sort of problem), and it doesn't provide access to the sorts of features that vendors want to show off about their peripherals.  It might as well be Arduino :-(
 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #42 on: November 01, 2019, 10:43:26 am »
.
« Last Edit: August 19, 2022, 02:34:14 pm by emece67 »
 
The following users thanked this post: Karel

Online iMo

  • Super Contributor
  • ***
  • Posts: 4786
  • Country: pm
  • It's important to try new things..
Re: PIC32MX vs STM32L4, my first impression
« Reply #43 on: November 01, 2019, 11:17:08 am »
.. It might as well be Arduino :-(

There is the "UECIDE" IDE supporting pic32, arm, risc-V, avr..
Written by a guy who understands the topic pretty well..

https://uecide.org/about
« Last Edit: November 01, 2019, 11:19:52 am by imo »
 
The following users thanked this post: thm_w, GeorgeOfTheJungle

Offline alexanderbrevig

  • Frequent Contributor
  • **
  • Posts: 700
  • Country: no
  • Musician, developer and EE hobbyist
    • alexanderbrevig.com
Re: PIC32MX vs STM32L4, my first impression
« Reply #44 on: November 01, 2019, 02:39:14 pm »
This thread inspired me to try my PIC32MZ again (I use STM32F at work) and this time I did not try Harmony.
I've been trying to get a simple SD -> I2S -> DAC project going. I could not get it working with Harmony and I found no good docs or help to get it working.
Yesterday I tried with the documentation and using bare metal. Got it wokring in an evening! So for me, the low level docs really are amazing (and works, opposed to ST), but the high level docs are really bad (opposed to ST which has relatively good docs and example projects. Truthfully though, it may just be me being extremely bad at finding the correct resources.

I will definitly stick with Pic32 for a while longer. For tests and projects I tend to grab the closest devkit (usually a cypress or STM) but I will make sure the Pic is easiest to grab for a few months.

OP: Thanks for the inspiration!  :-+
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 4786
  • Country: pm
  • It's important to try new things..
Re: PIC32MX vs STM32L4, my first impression
« Reply #45 on: November 01, 2019, 03:50:35 pm »
Pic32MX was my favorite one for several years in past, as it was the first mcu with 128kB on-chip sram allowing interesting projects.
For example http://retrobsd.org/wiki/doku.php/start porting 2.11bsd Unix on it.
There is a port of 4.4bsd Unix on the pic32MZ (512kB of on-chip sram).
With pic32MZDA (32MB of on-chip dram) you may install Debian on it (has been done afaik).
Otherwise both pic32MX/MZ and STM32F4+ are almost identical in performance when comparing them clock to clock.
STM32F4 has got a single precision FPU, while MX has none, and MZEF sports a double precision one.
Some people consider the MIPS architecture of the pic32 nicer, and its internal sram is not fragmented, as it is with STM32F4+.
Well, it is just matter of taste what is better, imho :)



« Last Edit: November 01, 2019, 04:10:35 pm by imo »
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
Re: PIC32MX vs STM32L4, my first impression
« Reply #46 on: November 16, 2019, 07:34:24 pm »
Just got a few of these ali boards (F4-blackpill)
https://www.aliexpress.com/item/4000138305460.html

STM32F411CEU6 core board 128KB RAM 512KB ROM

Used libopencm3 , and it took me 10 min to get blinky running @48MHz , the project i had already for a STM32F030
And another 30 min to get my desired 96Mhz (had to make my own pll table) , and learn about GCC (g++) not being forgiving , when using named struct initializers

This site was a super intro to libopencm3
https://rhye.org/post/stm32-with-opencm3-0-compiling-and-uploading/
« Last Edit: November 16, 2019, 08:00:22 pm by bingo600 »
 
The following users thanked this post: thm_w, techman-001

Offline KarelTopic starter

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: PIC32MX vs STM32L4, my first impression
« Reply #47 on: December 03, 2019, 04:23:06 pm »
Another update about my adventures with STM32. This time I'm using a NUCLEO-F439ZI  and I successfully wrote a low-level driver for the ethernet interface (not using HAL!).

Next step was to pull LwIP (Lightweight TCP/IP-stack) from git and to configure and compile it. I don't like libraries in general (it's the reason I don't use HAL)
but I must admit that LwIP is written very nicely and cleanly. Still, the first time it's quiet a job to configure everything correctly.
I use it in non-OS mode so I can only use the "raw" API of LwIP.

The last step was to connect LwIP to my driver and test it. What is working so far: ARP, DHCP, ICMP, UDP and TCP.
Using a LAN connection to my linux pc listening at an open tcp port, the NUCLEO-F439ZI  was able to transmit 5 MByte/sec. using a 100mbit LAN connection.
The NUCLEO-F439ZI  was running at 180 MHz clock speed.

 :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf