What’s new for 2012?

To start off 2012 Vernon’s Excellent Blog remains ad free, PPC free, and for the time being an outpost of free speech with an Electronic and Software Engineering bent. In anticipation of the new Year and with a Prosperous 2011 drawing to a close, I began the process of forming a new Business Venture “Engineer LLC“. With a portion of my earnings from Contract work, I have formed a new LLC organization to serve as a foundation for the several business ventures that I have been incubating or planning over the course of 2011.

    • Vernon Johnson Engineering Services has been consulting with private Inventors in 2011 to assist in bringing new inventions to life!
    • Spidersource Unlimited is my vision for a provider of Consumer and Technical Software in the mobile marketplace. It has yet to be officially launched as of this writing.
    • dc-johnson.com was created in January of 2008 in response to an inquiry by a Ferrari restorer and as a tribute to my Father’s invention of aftermarket emission control devices for the Automotive “Grey Market” of the United States in the early 1980s. The site serves as a source of information for owners of these now antique Automobiles. Occasionally, a request comes in for assistance to this site which will now be a division of Engineer LLC.

There may be other ventures in the future that will emerge as projects or ventures of Engineer LLC.

The new web presence for Engineer LLC is hosted by Dreamhost. I have been using them for 7 years (ever since I started publishing public web content). This blog you are reading right now is hosted on Dreamhost. If you are considering opening a new web Hosting account, I strongly recommend Dreamhost. Should you choose to use thier services, use the promo code NEWUSER2012 and you will get an additional discount when you create a new account with Dreamhost. Full Disclosure: I do receive a small referral fee for referring new customers.

Vernon Johnson

January 24, 2012

PIC32 SPI to MCP4922 or “Why I get the BIG Bucks”

I just completed an exercise in bringing up a MCP4922 DAC on the PIC32 SPI. I didn’t find any examples specifically using the PIC32 and MCP4922 or even any examples of the MCP4922 in use in a 3.3v circuit. Therefore I thought a post might help the next fool that comes along and tries it…

1. The PIC32 Peripheral Library Help file is not much for detail, I found a need to dig into the SPIxCON register table in the PIC32 datasheet just to get definitions for the Input Parameter Mnemonics.

2. The CLK and SDO lines both need to be pulled up with at least 10K (I ended up using 4.7K). Further design refinements included pull ups on CS and LDAC with 10K to ensure sufficient loading on the PIC32 outputs, .01uf bypass caps on the outputs to filter the switching noise out and closer coupling of the MCP4922 P/S bypass caps to 4mm or less from the Vdd pin as recommended in the datasheet.

3. When halting just after a TX everything worked OK but it got unstable when I let it run free at an update rate of 10HZ or even slower. After much troubleshooting (including assuming that I had damaged the DAC chip) it became apparent that the instability was due to data/clock sync errors. I found that it requires the CKE transition to be inverted (CKE = 1, SPI_OPEN_CKE_REV) to shift data out before the clock to run stable. Indeed, now it runs smooth and clean at a 1MHz SPI clock rate. YAY!

Here’s the SetDAC Function (Written in C32 v2.01)

SetDAC_PIC32_MCP4922.txt

And now it works!

Clock and Data Waveforms @ 1MHz

Clock and Data Waveforms @ 1MHz

Happy Coding…