PIC24F clock switching issues

This is just a winge, really.

I'm using a PIC24F that supports USB. It has an errata list as long as your arm, and already includes two issues related to switching between clock sources. One basically says that a particular feature just doesn't work, and not to use it. The other has a workaround.

Well, I've just discovered a third that's caused me considerable tearing out of hair. I have a test program that proves it, and I'll submit it to Microchip in due course.

Clock switching in MCUs has been around for a while now. Just how hard is it to get these things right?

Sylvia.

Reply to
Sylvia Else
Loading thread data ...

It requires analog skills and those are in very short supply. You can also see it in job descriptions, "Knowledge of VHDL and yada, yada". Analog? Nothing.

I could ask a very similar question: POR/BOR has been arond for a long time. Why is it that the POR/BOR circuitry in many processors is borderline junk and we must design our own external circuits?

--
Regards, Joerg 

http://www.analogconsultants.com/
Reply to
Joerg

One of the defects in the errata involves enabling/disabling a prescaler connected between the clock and the CPU. I'd have thought that was a very straight-forward synchronous operation that is trivial to implement correctly, yet somehow it stuffs up the execution of the next instruction.

Do they even test these things before making production quantities and shipping them?

Sylvia.

Reply to
Sylvia Else

That is indeed a sorry state of affairs.

I don't know because I do not use PICs. These days many mfgs purchase or license IP blocks. Testing might be a bit on the thin side then.

Testing isn't hip anymore. I just purchased bicycle lights for my mounain bike. Figured if I plunk down more money and buy an American product it would be great. Turns out the LEDs are mounted crooked in there and that messes up the bem profile, big time. The answer from their support floored me: "Rear LED lights are not designed to have precision aligned bulbs" ... say WHAT?

So I'll quickly see if I can correct the flaw they think is ok, otherwise they'll have to eat the return and refund the money. Coincidentally the Chinese front lights I ordered the same day work and have properly aligned optics. It isn't the first time this has happened.

--
Regards, Joerg 

http://www.analogconsultants.com/
Reply to
Joerg

This is Microchip you are talking about. While they are famous for some good things, such as continuing to produce popular chips for decades, they are also famous for long errata and poor design testing.

When the PIC32 came out, they made vast numbers of a nice little demo board that included, amongst other things, a 480 Mbps high speed USB port. Shortly after production and distribution, came the announcement that there were problems with high speed USB on the chip. The errata simply said that high speed mode doesn't work, and the work-around is to use low speed 12 Mbps USB! It is not that it was unreliable, or had issues - 480 Mpbs mode simply did not work at all.

So they had managed to make a chip where one of the selling points was the fast USB (most microcontrollers at that time were limited to 12 Mbps USB), yet the high speed USB mode did not work. They put it on a demo board, mass produced the board, and distributed it as part of the announcement campaign - though it had never worked at high speed.

(The first PIC32's had errata lists longer than your /leg/ - the USB issue was just the most "impressive".)

Reply to
David Brown

  • Would the stupidity of adding a NOP for that next instructionbe useful?
Reply to
Robert Baer

That's their specified workaround, and so that particular issue is not such a big deal, though one is left wondering what happens if an interrupt should occur just then. Can the interrupt be stuffed up instead?

I'm not using it anyway - the power saving benefits don't seem very high.

Sylvia.

Reply to
Sylvia Else

Are you committed to the Microchip stuff?

Reply to
John S

Not especially, no.

Sylvia.

Reply to
Sylvia Else

"1. Disable interrupts during the OSCCON register unlock and write sequence."

Reply to
bloggs.fredbloggs.fred

Microprocessor errata sheets are starting to read like the bug lists in some poorly-run software projects I've had the misfortune to be on.

Which makes me think a few things:

1: HDL digital design is like writing software! Unfortunately.

2: The microprocessor manufacturers can and should work on the "poorly run" part

3: There is a huge and growing body of knowledge on how to do software right. There's no reason that this cannot be applied or adapted to digital design with HDL.

4: I can't speak for all manufacturers, but of the ones that I've really paid attention to, the ST ARM-Cortex stuff seems to have the nice short errata lists, and it doesn't seem to stem from dishonesty, either.

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

I like the Cypress PSoC 4 series. And I have nothing to gain from recommending them.

Cheers, John

Reply to
John S

Good that you put that disclaimer in there, you're such a powerful influence on purchasing decisions the FTC probably follows your every word.

Reply to
bloggs.fredbloggs.fred

Thanks, Fred. It would be nice if the same could be said for you.

Reply to
John S

I was talking about the PSOCs a while back with someone. That wasn't you was it?

The PSOCs are interesting, but I can't say I "get" the 4s. The PSOC1 devices were all about the programmable analog and digital blocks. The PSOC 4 devices barely have any and some actually *don't* other than a couple of flexible serial ports. The 5 series seems to get back to the programmable blocks. I can't recall, does the 5 series have the CM3 or the CM4 with DSP instructions?

--

Rick
Reply to
rickman

I'm not talking about OSCCON. This is about DOZE/DOZEN.

No doubt disabling interrupts would obviate the possible concern with interrupts, but doing so is not specified in the workaround in the errata.

Sylvia.

Reply to
Sylvia Else

Including needlessly rewriting previously working stuff, perhaps.

Sylvia.

Reply to
Sylvia Else

It specified in the reference manual as part of the sequence for changing clocks.

Reply to
bloggs.fredbloggs.fred

There's nothing there to say that interrupts have to be disabled when DOZEN is set or cleared. Indeed, it can be cleared automatically as a result of an interrupt (ROI bit), and higher priority interrupts would remain enabled.

Sylvia.

Reply to
Sylvia Else

Maybe. I don't remember for sure.

The P4 device I'm using in 3 of my products has the following:

Programmable Analog ?Two op amps with reconfigurable high-drive external and high-bandwidth internal drive and Comparator modes and ADC input buffering capability ?12-bit 1 Msps SAR ADC with differential and single-ended modes and Channel Sequencer with signal averaging ?Two current DACs (IDACs) for general-purpose or capacitive sensing applications on any pin ?Two low-power comparators that operate in Deep Sleep

The ADC can be configured to automatically MUX a bunch of input channels. I am using 4 analog inputs along with many digital I/O in a controller to determine day/night conditions, control the charging of a battery from a solar cell, display messages to motorists with LEDs, communicate via serial I/O, and control other support functions.

The P4 has less quiescent current, costs less, and is many times faster than the P1. In addition, the GUI for design and programming is many times more powerful than the GUI for the P1.

I'm not trying to convince you to use it. I am simply telling you that it makes perfect sense for ME to use it as the advantages of doing so are clear.

Reply to
John S

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.