This article introduces the reader to a set of up to date Serial Bootloader tools for Microchip 8 bit PIC series products that we frequently use in electronic designs featuring an 8 bit embedded MCU (Micro Controller Unit).
So what is a Serial Bootloader and why would anyone want it?
In some products that use an MCU it may be advantageous to allow the program to be updated in the field or at a service shop without the specialized programming gear needed to completely reprogram it. For this purpose the MCU is equipped with a small primary program whose sole purpose is to facilitate updating of the main device application program. In embedded systems this is sometimes referred to as a “Bootloader Stub” since it is often located at the beginning or end of the program memory space, and is the first code to execute on start or reset. When the device starts, the Bootloader checks for a special state or instruction. If that object is present, the Bootloader waits to download and overwrite the Application Program with an update. Otherwise the device continues on to execute the full Application Program. Some such devices have a USB port that can be used as the communications for this but it is less common than other serial port types that can be implemented at lower cost. One of the most common serial port types on low cost embedded designs is the venerable RS-232 port. In fact, many different MCU devices have one or more built in UART devices (direct support for RS-232) while just a handful build in the more complex USB port.
For example: recently tasked with redesigning a controller PCB for an existing product, there was no need or desire to change the interfaces, only update the components that were obsolete. One of the obsolete components was the Microchip MCU, a 40 PIN DIP with insufficient Flash memory for program updates and a shortage of digital I/O. It was replaced by an 80 pin TQFP variant with more memory space in all 3 categories (Flash, RAM and EEPROM) more I/O of course (to eliminate the previous I/O sharing scheme and provide for expansion) and perhaps most important at a lower cost than the old part it replaces. A dedicated ICSP (In Circuit Serial Programming) port replaces the practice of burning the old DIP parts in in an old EEPROM programmer appliance. The product also uses an RS-232 port to communicate with a control computer. In this case, it was decided to leverage the existing RS-232 port in the design for firmware maintenance. The larger Flash space of the new MCU allowed adding the Serial Bootloader feature to eliminate the need for any dedicated programmer equipment when updating units already programmed at least once. All that is needed is a PC to run the AN1310 PC Bootloader application equipped with a RS-232 serial port, an established serial link between the computer and device to be programmed and the program update in the form of a .hex file.
The Application Note from Microchip, AN1310 provides all of the resources needed to accomplish the addition and operation of the Serial Bootloader with many variants of the PIC16F and PIC18F 8 bit MCU families having an available UART port.
In an earlier post, A high density Automotive control design using the Microchip PIC32MX MCU was described. That design was a great success. However, as with all things new it was found to be in need of more I/O. The circuit board was revised to double all of the digital and analog peripheral I/O while retaining the same overall PCB outline of 5″x7″. it was also kept to just 2 layers and components on only one side, again with the help of the peripheral circuitry simplicity afforded by the Microchip PIC32MX360F512L MCU.
While it is a bit more dense that the previous revision, it still fits without too much crowding on the 5″ x 7″ 2 layer PCB.
Reposted from Vernon’s Excellent Blog (original date 12/16/2011).
I recently completed an exercise in bringing up a MCP4922 DAC on the PIC32 SPI. I didn’t find any examples specifically using the PIC32 with MCP4922 or even any examples of the MCP4922 used 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) scope trace snapshots revealed the instability was due to a data/clock sync error. Specifically the clock burst was terminating early on random data write events. 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!
In EV electronics, the Electrical Storage System (ESS) is typically isolated from the lower voltage system for lighting and accessories. In many installations this creates a need for isolated signal conditioning for ESS instrumentation when that instrumentation is powered by the low voltage system. I found an off the shelf “Demo Board” for the Analog Devices AD7400A Isolated Sigma-Delta Modulator that made it quick and easy to build up an Isolator/Scaler module for monitoring the ESS with a 0-500V range. The output is compatible with the 3.3v range of the custom control module on a prototype vehicle that is currently under test.
The HV input and 12v power source are fused for protection. The HV input is divided to yield a 0-320mv range at the input of the AD7400A. The output produces a fully isolated and scaled voltage of 1.65 to 3.3v that is linear (difficult to achieve with more common optical isolator circuits). The output is essentially an isolated and 5X amplified version of the 0 to 320mv input with a floor of 1.65v This equates to an ~1.65v range on the output (0.320 X 5).
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. Engineer LLC is now operational and forms the new “Parent” organization for several business ventures…
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.
Vernon Johnson Engineering Services has been consulting with private Inventors since 2004 to assist in bringing new inventions to life! Vernon Johnson Engineering Services also occasionally provides Advanced level Computer Networking and Systems Engineering services to Clients with challenging Computer needs. For the time being, Vernon Johnson Engineering Services will remain independent for existing Consulting contracts. New Consulting contracts will be fulfilled through Engineer LLC.
There may be other ventures in the future that will emerge as projects or ventures of Engineer LLC as well.
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) and must say I am a very satisfied customer. 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 their 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.