Author Topic: PIC32MK - Stupid UART/DMA/CPU Design - Be Careful!!  (Read 2564 times)

0 Members and 1 Guest are viewing this topic.

Offline FxDevTopic starter

  • Contributor
  • Posts: 42
  • Country: tw
PIC32MK - Stupid UART/DMA/CPU Design - Be Careful!!
« on: May 03, 2020, 12:00:21 am »
I'm working on this issue over 1 week. Maybe someone is missing about this point and will work a lot. Be sure about what you are using.
I wrote it to Micrcohip's forum, I hope they will change their datasheets about that.
 :palm: :palm: :palm:

Quote
I'm using dsPIC33EP series and MPLABX since Beta version, for nearly 11-12 years. Very good products, love it!
 
Last year Microchip guys came with PIC32MK series. I'm working PIC32MK for one year. PWM + ADCs are great with no problem. I made very huge power converters ext. I liked this MCU believe me until last Week!
 
Last week, I have to use use UART1 and UART2 with DMA and suddenly CPU stops after 5 sec. Sometimes it stops after 20sec. Sometimes it works 20 min. after CPU stops. Can you believe it, it stops! Freezes like a north pole!
 
After that I read Errata DMA section. They explained that PIC32MK Errata number 55.
 
Oh come on guys this is very nuts!
 
Think about that; you gave us 6 UARTs, you commercial like that! So If I want to use any UART1-2-3-... with using RX Interrupt and DMA (because I'm not an Arduino hobbyist, I'm a professional, I have to use DMA) to transfer data, CPU is gonna STALL! Why because CPU and DMA using same Perib. Bus! Ok I can use UART1 to receive and UART5 to transmit, but I cant use any SPI or any ICx interrupt, damn! And believe me you can not find this error with any Pickit3-Pickit4-ICD4 or another sh*tty debuggers programmers.
 
So at the end, you have to think, which PBx is gonna connect to DMA or which PBx is gonna connect to CPU. In my opinion, PB2 has to be controlled with CPU and PB3 has to be responsible for DMA works.
 
This guy has suffered a lot about this! I'm so sorry for him.
https://www.microchip.com/forums/m1121925.aspx
 
Please change your datasheet and errata about that. USE VERY BIG FONT to warn users about that, especially on Figure 1.1.
 
P.S. I have never though I will try to use STM32 someday, but thanks to your designers, today I ordered STM32G4 kits after using Microchip 11-12 years later.
 
The following users thanked this post: abraxalito

Online JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: PIC32MK - Stupid UART/DMA/CPU Design - Be Careful!!
« Reply #1 on: May 03, 2020, 06:54:41 am »
Wow.
I was not aware of that thread.
I actually do not use DMA much (and mainly i use the "dedicated ones" in ADC,CAN), i mostly run code in interrupts because i need to have the least possible latency, communication is low priority so i just use the buffers.
but i still have a project where i want to use one

the PIC32MK is a stillborn with great potential, at a great price point. a MICROCONTROLLER with TWO USB, and a library for it about 3 years after introduction, TONS of ANALOG PERIPHERALS, many of which crippled by new erratas, TONS of communication peripherals, but you have to bitbang I2C with the promise of a fixed IP sometimes in the future and now this dma issue that goes deeper than what the errata says.

Also the issues with the cache and memory prevented it from having a tiny bit of grunt. I kept using dsPIC (and an ancient dsPIC33EP MU for USB things) because control loops run faster and less interrupt latency. Plus the dsPIC33C is a crazy beast

When it came out i was planning to build a small engine ECU but there was basically zero support. No support + bugs -> nobody uses it -> no sales -> no incentives to bring support and fix bugs -> nobody uses it -> ...
However, later this year (i think) they are releasing two new families and i think they'll want us to migrate to the new silicon (not that i'll complain about that). It was necessary as they replaced the flash with ECC flash and CAN with CAN FD. So there must be at least one big fish using those chips, so not all is lost. Hopefully more bugs will be fixed
 

Offline FxDevTopic starter

  • Contributor
  • Posts: 42
  • Country: tw
Re: PIC32MK - Stupid UART/DMA/CPU Design - Be Careful!!
« Reply #2 on: May 03, 2020, 01:54:22 pm »
I read lots of data about STM32 especially STM32G4 series.
They explained them in AN4031 and AN2548.
They are using round robin system for CPU, DMA1 and DMA2 with bus matrix. Very easy solution. For example if CPU and DMA want to access UART1 same time, first CPU access it after DMA, then CPU and so on. Never goes latency or freeze the CPU.
Maybe it makes to lost 1-2 cycle to access memory or perib. but MCU never goes stall position.
-----------------------------****************---------------------------
By the way, I compared PIC32MK and STM32F334.
 
I have a library for One Phase SOGI-PLL algorithm.
 
For integer arithmatics (32 bit long): PIC32 (120Mhz): 1,9us - STM32F334(72MHz): 1.5us
For Float arithmatics: PIC32 (120Mhz): 4us , STM32F334(72MHz): 4us
 
120MHz MIPS32 equal 72MHz Cortex-M4 in core level.
Datasheets say, PIC32 @120MHz (198DMIPS), STM32 @72MHz (210DMIPS).
 
So it's very easy to understand.
« Last Edit: May 03, 2020, 01:57:24 pm by FxDev »
 

Offline Electrons

  • Contributor
  • Posts: 13
  • Country: gb
Re: PIC32MK - Stupid UART/DMA/CPU Design - Be Careful!!
« Reply #3 on: November 06, 2021, 03:22:21 pm »
thank u for mentioning this

I was wondering is this issue a design which they cannot correct it even in later revisions unless they redesigned the core ? or is it a mistake somewhere that could be corrected ?

i am asking this since i see that they released the pic32mk xxxx MCM . the errata is clean and the problem is not mentioned , but i am afraid they now state it in the datasheet somewhere hidden in tiny font  ::) . Since in figure 1.1 they block diagram of the core and buses looks the same.

I really like the new chip and would like to use it and was hopping you could shed some light on the subject.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf