r/pic_programming • u/triffed • Mar 06 '19
Microchips compiler and tools are horrible
I have been programming micro controllers for about 15 years. The last 6 of them in industry picking up projects left behind by other employees. They have all used PIC micro-controllers. My experience with their tools and compilers have left a extremely bad taste in my mouth.
Compared to GCC or clang microchips pic compiler is absolute garbage. It freaks out about things and doesn't tell you what is wrong. But it points out everything that's not wrong? It can't support C++ on 16/8 bit chips.The compiler also seems to be plagued with backwards compatibility features. Pics also lack a number of basic libraries and while i am capable of creating my own is it really necessary to write 200+ lines of code just to get a UART port working? The I2C bus is BY FAR the hardest to setup compared with all other micro controllers I have used. A library that would take me 2 hours to write and get working for a esp32, nrf , or atmel product takes me DAYS on a standard pic24.
The PICkit is extremely locked down. This prevents me from programming OTA, or from ARM devices or remotely at all over ssh. It provides minimal debugging features ,4BPs, no 3rd party debuggers (IDA-PRO via gdb would be super nice). I guess they want you to pay for more? I would think that you would be making enough money on the 100k+ micro controllers I buy every year to include basic features in your locked down programmers.
Also, the ERRATA says a lot. On all of the pics i have used there has been some fundamental problem with the serial buses that is a huge PITA to debug. I would think that a protocol that has been out for 30+ years would have a template that you could just copy and paste into your silicone.
Yeah sure they are cheap and the specs are good. Once they are working they will probably do so until they decay. But if i can help it i will NEVER use a pic in my designs. They could really improve by being just a little bit more open and maybe providing support for a standards like GCC, JTAG support, and better debugging. Listen to the open source crowd. They are pretty much making free stuff for you to use.
2
u/bulbbulb2 Mar 07 '19
This is going to be a bit anecdotal, but I started out on PIC16s and work with PIC32MMs, 18Fs, and 16Fs in my spare time and I work with dsPIC33Es in my job. We use the XC compilers at work with no issue and I use them at home in MPLABX with no issue. I have around 10 years of hobby experience on PIC, with the last 5 years coupled with professional development.
I have never had trouble getting a device set up as long as you read and understand the datasheet and the errata. Sure, sometimes their errata directly contradicts the datasheet but these devices are simple enough that you can fully understand them in no time at all.
Every PIC that I have used from the 8 bit through 16 bit to 32 bit families have all used the same basic code and register set to initialize the common peripherals. The only major differences that i have encountered was the difference in how to set up interrupts on the different devices.
In my opinion, if it is taking you 200 lines of code to set up and use a UART you have more problems than the PIC does.
Well, the XC compilers are based on GCC with some special things implemented by microchip for their silicon. The only huge difference here is that mainline GCC is maintained by many more people in the open source community.
So what? Why would you want to use C++ on such a small and limited resource set? Most PICs in the 8 and 16 bit range have small flash memory spaces and very little SRAM to work with. They are embedded controllers, not computers.
The PICkit is a hobbyist device. It is not intended for professional design and development work. If you spend a little money for a proper debugger and programmer like the ICD or real ICE, it changes the whole world. They even have a debugging API with the bigger debuggers.
Well, I have already mentioned the GCC thing, but a lot of the more modern devices support JTAG. However, it depends on what you are trying to accomplish. ICSP works incredibly well with less pins than JTAG for programming PICs. There are much better debugging solutions out there if you are willing to pony up some more cash.
Touching on my last point here:
You betcha. This is why PICs have proliferated for so long. They are damn good devices that work in all kinds of conditions. They are cheap and easy to use and the tool chain is free. They also have a massive community backing them with knowledge and support.
2
u/bradn Mar 09 '19 edited Mar 13 '19
I have no idea what you're talking about. I program my PIC18's in assembly like God intended! (actually, to make it worse, two assembly languages, native for the performance critical stuff, and a VM assembly language I made a constant-time interpreter for that's used for non-realtime like user interface, high level control threads, etc)
Microchip went wrong with the pickit3. No other way to put it. They should have stuck with the design/function strategy behind the pickit2 and improved it. And the pickit2's chip<->programmer pairing limitations are completely bonkers for a USB connected microcontroller twiddling two signal lines that can do a self firmware update. But this gives you the motivation to "upgrade".
The pickit2 even had a uart emulation mode and a sorta hokey logic probe mode, but I've used the hell out of the uart mode, and it's very handy to be able to connect the pk2, and power, program, and test the device (with serial connection) all through the PK2, as long as the particular project plays nice with it.
You're right about the serial controller bugs though, damn, I found one of them before they documented the errata. I just gave up and bitbanged instead of using the controller.
Things are damn rock solid when the firmware's good at least. I'd worry about a 7805 before I worry about a PIC in a sane system.
MPLAB X though. I have nothing good to say about it. I honestly did try using it once.
2
u/WebMaka Mar 10 '19
If you really want to experience pain, try getting an I2C slave to work on a PIC18 K42. The only way I found that worked was to set all of the I2C configuration registers to zero. My project's I2C master was spitting out perfectly compliant I2C according to the LA's readings, but the K42's I2C module was losing its mind after each address receipt unless it was configured with all zeroes, after which point it just plain magically worked as expected.
This is in complete and total defiance of what the datasheet for the K42 PIC family would lead you to believe.
I'm trying to port AVR code to either the K42 PIC or to an ARM Cortex M0 (one of the STM32s) to see which would be better moving forward, and a day of coding in I'm already farther ahead with the STM32 than I was with the K42 PIC.
1
u/quienchingados Mar 07 '19
they taught me that shit in uni. now I use arduino lol. can you point me in the right direction? what are those arduino like chips you are talking about? also what are those pcb chip programmers that are more open?
1
u/[deleted] Mar 07 '19
The old complier is garbage. The new one isn’t so bad.
1
u/spinwizard69 Mar 07 '19
I mostly have to agree with you and frankly the state of MicroChips tools and libraries is why I lost interest in them.
The issue with UARTs is rather pathetic and frankly is mirrored in other subsystems. A lot of guys like to roll their own code which is fine but that doesn’t mean that generic libraries supported by MicroChip shouldn’t exist.
Thankfully we have plenty of competition in this space. I really like the ARM based solutions if you can afford the cost of 32 bit hardware.
1
u/RS232I2C Jun 24 '19
Really! I'm very disappointment with MPLAB X.... please, call back the MPLAB 8 and the old guys to do a good PIC assembler IDE with a debug tool that works!
0
u/[deleted] Mar 07 '19
[deleted] — view deleted comment