This is only a preview of the December 2013 issue of Silicon Chip.
You can view 23 of the 104 pages in the full issue, including the advertisments.
Items relevant to "Build An Electronic Bellbird":
Items relevant to "PortaPAL-D: A Powerful, Portable PA System, Pt.1":
Items relevant to ""Tiny Tim" 10W/Channel Stereo Amplifier, Pt.2":
Purchase a printed copy of this issue for $10.00.
The new PIC3 C322MZ microcoo n tr microc trooller By GEOFF GRAHAM We first introduced Microchip’s then new PIC32 microcontroller to SILICON CHIP readers back in March 2011. At the time, we marvelled at its capabilities and went on to use it in our popular Maximite series of computers. Now Microchip has an updated version which was released just a few weeks ago. It’s called the PIC32MZ. The PIC32MZ has over three times the speed and four times the memory capacity of its predecessor and includes a new central processor and better peripherals. Photo courtesy Microchip. This photo shows one of the TSMC semiconductor fabrication plants located in Hsin Chu, Taiwan where the PIC32MZ is manufactured. Photo courtesy Taiwan Semiconductor Manufacturing Co Ltd. I N REALITY, the PIC32MZ is more than just a simple update. With over three times the speed and four times the memory capacity of its predecessor, it’s better described as a leap forward. This new chip also has a new central processor, better peripherals 44 Silicon Chip and new features such as the ability to remap I/O pins to make the PCB layout more efficient. Speed & memory The headline features of this new chip are its vastly improved speed and memory capacity. The PIC32MZ will run at up to 200MHz and has up to 2048KB of flash memory and 512KB of RAM (both four times that of the PIC32MX series). There are chips on the market with a higher speed and with support for more memory – such as the ARMbased processors typically found in mobile phones. However, these generally require additional RAM and flash memory chips, increasing PCB siliconchip.com.au This is an example of the silicon wafer on which the PIC32MZ is fabricated. It is the percentage of working chips on the wafer (the yield) that is important to the profitability of the manufacturer. Photo courtesy Taiwan Semiconductor Manufacturing Co Ltd. complexity, or else have significantly less RAM and flash. By contrast, the PIC32MZ integrates all of these features and more onto a single chip. Because the PIC32MZ is a complete microcontroller, it’s simple for designers to use. It just needs a supply of 2-3.6V (a couple of 1.5V cells will do) and some decoupling capacitors – no other support circuitry is required. You then have a very fast chip that has plenty of capacity for almost any job you could think of – even if it requires multiple communications stacks, full colour graphics, audio processing and more. The main programming language for the PIC32MZ is C and as long as you are happy writing in this language, you will find that developing software for this chip is relatively painless. This is due to the chip’s easy-to-use 32-bit architecture and the free support software provided by Microchip which includes the development environment, compilers and application libraries. size or 32-bit mode for speed and computational power. The processor can run at up to 200MHz, which means that it will run your code at roughly three times the speed of the older series. This core is also backwards-compatible with the M4K core used in the earlier PIC32 microcontrollers, so existing firmware can be easily be ported. To improve performance, large RAM caches are used for both the instruction and data streams. The instruction cache is especially important because flash memory is quite slow and without a cache the processor would run at just one-half of its capability. Performance is also helped by a bus matrix which connects the input/output interfaces directly to the memory and bypasses the central processor. This frees up the processor since it is not required to copy each data byte to the interface. Perhaps the most exciting feature of the microAptiv MPU core is that it contains a Memory Management Unit (MMU) which is required by advanced operating systems like Linux. So in all probability, we will see Linux running on the PIC32MZ in the future. Another important feature of the PIC32MZ is that it’s economical in its power consumption and draws just 200µA per MHz of clock speed. At its maximum clock speed of 200MHz, the PIC32MZ will draw about 40mA which is half the current drawn by previous PIC32 chips when running at 80MHz. Die shrink Faster speed, increased complexity and less power all point to what the semiconductor industry calls a “die shrink” – a reduction in the dimensions of the transistors used in the chip. By shrinking the transistors, more can be crammed onto the same-sized chip and because they are smaller, each transistor will switch faster while drawing less current. For the PIC32MZ, the die shrink involved moving from a 180nm process to a 90nm process. This isn’t at the leading edge of technology (which can be as small as 14nm) but it’s excellent for a low-cost chip. The downside of a die shrink is that it’s harder to make the chip and the production process has to be carefully managed to ensure that enough working chips are produced on each silicon wafer. This is the “yield” and a manufacturer can live or die on this statistic. Peripherals While a high-speed processor is important, it’s the peripherals that make it practical to use the device in a circuit. These peripherals are the subsystems and include timers, I/O ports, communications interfaces and so on – all the things that make the chip useful as an embedded microcontroller. New CPU The PIC32MZ uses the new 32-bit microAptiv MPU processor core from MIPS (Fig.2). This is an advanced pro cessor consisting of millions of transistors and can operate in either 16-bit instruction mode for small code siliconchip.com.au Fig.1: the internals of the PIC32MZ are complicated and more like a full-sized computer than a microcontroller. Two important features are the “High Speed Bus Matrix” and the “Peripheral Bus” which facilitate interconnections to peripherals without the involvement of the CPU. Diagram courtesy Microchip. December 2013 45 Fig.2: the MIPS microAptiv MPU core is the central processor for the PIC32MZ. It includes the 32 bit optimised pipeline processor and supporting circuitry such as the instruction cache to speed execution of code stored in flash memory. Diagram courtesy MIPS. The PIC32MZ can communicate with external devices in many different ways. One is via a 10/100 Ethernet Media Access Controller (MAC) which is integrated on the chip. With the addition of a driver chip (called a “PHY”), you can then connect the PIC32MZ to an ethernet network. Another important interface is the USB 2.0 high-speed interface which can work both as a host and as a device. This means that you can design an appliance which allows the user to: • plug in a USB memory stick or USB printer; or • connect the PIC32MZ to a computer as a device for uploading and downloading data. Other communications interfaces integrated on the chip include CAN (which is used in OBD2 for the automobile industry), serial UARTs, SPI, I2C and parallel ports. One very useful feature is that you can select what I/O pins most of these interfaces appear on. This simplifies board layout and it means that you do not have to resolve a conflict when multiple interfaces want to use the same set of I/O pins. Audio & graphics Furthering this high level of integration, the PIC32MZ includes peripherals which make it easy to generate high-quality graphics and audio outputs. The External Bus Interface (EBI) Fig.3: the Harmony Library was introduced with the PIC32MZ and consists of ready to use code modules for handling peripherals such as the Ethernet, USB, CAN, etc. This code is supplied free of charge and can dramatically reduce development time. and Parallel Master Port (PMP) interfaces facilitate communications with graphical LCDs and other parallel devices. The SPI/I2S module provides a synchronous serial interface that is useful for communicating with digital audio devices and external serial devices. I2S is the standard for communicating with digital audio converters (DACs) and with the right DAC, the PIC32MZ can generate very high quality audio. There are many more features of this chip that are outstanding (eg, a 12 bit analog converter, a DSP instruction set and a real time clock) but rather than describe them all, it’s sufficient to say that the PIC2MZ is packed with almost everything that you might want in a microcontroller. Applications Most PIC32 chips have ended up in general consumer or industrial applications. Microchip would like to build on this market with the PIC32MZ and a focus on connectivity, graphics and audio. The attention to connectivity is particularly important as electronic devices are becoming increasingly interconnected, especially via the internet. In our review of the Altronics A2696 Internet Radio (elsewhere in this issue), we saw how it uses the internet to retrieve details of the radio stations that are available. In the future, more appliances will follow this trend. It could be a printer that connects to the internet to order fresh ink supplies when they are running low, a TV set that downloads programming information or a home medical appliance that emails medical updates to the patient’s doctor. Another example where connectivity could be exploited is a photocopier where the rental cost is based on the number of copies made. The copier could automatically “phone home” with this data. Even better, the photocopier could include its own web server so that the customer could use a browser to access it and monitor the number of copies per day and the associated cost. Internet of Things All this can be easily handled by the PIC32MZ and is part of a new concept called the “Internet of Things”. This is an evolving term and refers to 46 Silicon Chip siliconchip.com.au Because the PIC32MZ uses very fine dimensions for each transistor, any minute imperfection or dust particle could ruin the chip during manufacture. This means that cleanliness is important inside the fabrication plant, Photo courtesy Taiwan Semiconductor Manufacturing Co Ltd. intelligent devices that can exchange information between themselves and master servers. Examples include alarm systems, home automation, vending machines, fleet management and other applications that require remote monitoring. The idea is that people do not need to handle mundane tasks such as diagnosing a fault in an item of equipment. Instead, the equipment itself could signal a fault to its service centre and a technician would be automatically dispatched with the appropriate spare part. This is not as outlandish as it sounds. Already in large data centres, equipment such as disk arrays are remotely monitored and a technician is dispatched if a disk drive has failed. Because the array has built in redundancy, the operators of the data centre are often not aware of the fault until the technician arrives on their doorstep with the spare part. Everyday tasks If you are an experimenter, you are siliconchip.com.au probably wondering “would I have a use for such a powerful chip?”. The answer is “yes”, because you do not have to use everything it offers. In fact, it’s quite cost efficient for the experimenter who wants to use it for all sorts of everyday tasks. If you do not want to use the audio interface or the DSP instructions or some other feature, it doesn’t matter. You can simply leave them turned off and they will not consume any power. At a price of $US9.64 to $US14.35 for a single chip direct from Microchip, the cost of the unused features can be regarded as trivial. The chip is forgiving when it comes to a power supply (2-3.6V) and the 32-bit environment makes programming relatively simple. Throw in the free software tools and C compiler provided by Microchip and you have an inexpensive and easy solution for your next microcontroller project. About the only issue with the PIC32MZ is that it comes in a TQFP package with a pin spacing of 0.5mm. These days, that shouldn’t be a barrier because the chip can be easily soldered to an adaptor board which will bring the chip’s pins out to a connector with an easy 0.1-inch pitch. If you Google “tqfp adapter”. you will find many sources. Harmony Software Library One area where programming could be difficult for the earlier PIC32 is when interfacing to items such as USB, ethernet, SD memory cards and other complicated devices. In the past, Microchip provided individual software modules to cover these requirements but with the introduction of the PIC32MZ, they have launched the “Harmony Software Library” to provide this support. This is an integrated library of code modules that wraps support for most of the PIC32MZ’s features into easy-touse functions that can be called from your C program. A good case in point is the TCP/IP library which includes a web server, FTP, Telnet, email and more. Using Harmony, these functions December 2013 47 Creating A New PIC Microcontroller The PIC32MZ is an international affair. Designed in Arizona, the chips are fabricated in Taiwan and packaged in Thailand. The development process started in March 2011 and over the following 2½ years, a core group of about 30 engineers worked on the design. They were supported by many others in marketing, test and production. The first stage of development involved the creation of a 90nm library of components like transistors, gates, I/O pads, etc. At the same time, the specifications for the main chip and each module inside the chip were developed. These came from Microchip’s assessment of what features customers would demand of the chip and the target price once it was in production. Design engineers then worked for more than a year to turn the specifications into a register-transfer level (RTL) design. RTL is a high-level description of the flow of signals between registers and is used in the semiconductor industry to specify the logic of the chip in detail. The largest component of the design was the processor core which was sup- The PIC32MZ “Embedded Connectivity Starter Kit” from Microchip. can be conveniently added to your firmware. Other examples include USB support (both as a host and a device), FAT16 and FAT32 file systems for SD cards and USB memory sticks, graphics libraries and protocols such as CAN, serial, SPI and I2C. These modules have all been tested and it only takes a little work to integrate them into your program. The library also contains a num48 Silicon Chip plied by MIPS as an RTL package. The design of a 32-bit processing core such as this is a complex process which is why most semiconductor manufacturers licence a design from specialist companies like MIPS and ARM, rather than try to design and support their own. The RTL description was then converted to a gate-level description of the circuit by a logic synthesis software package. The results were then used by other software tools to place the components and route the interconnects to create the physical layout of the chip. At this stage, engineers could run software simulations to verify that the logic worked as expected. With the chip layout prepared, the first batch of chips became available for testing in March 2013. Subsequently, a number of silicon revisions were produced as bugs and other issues were found and corrected. It takes some time to test every possible configuration of a device containing millions of transistors and the task, involving numerous test engineers and willing customers, took almost a year. In addition, documentation needed ber of Real Time Operating Systems (RTOS) and all of the modules in Harmony are designed to work with an RTOS. This is significant because with the complex tasks that this chip will be expected to undertake, the programmer needs an operating system to partition the software into manageable sections while still efficiently responding to real world events. According to a recent survey (2013 Embedded Market Study by UBM Tech), almost two thirds of the cost of an embedded processor project was in writing and debugging the firmware. This is where a software library like Harmony becomes important – if you can simply drop in a complex module rather than write it yourself, it will have a large impact on the project’s overall development cost. The PIC32MX250 While we’re talking about the PIC32 line, we should also briefly mention the PIC32MX250 which was launched late last year. This is a slower version of the PIC32 (it runs at 40MHz) and to be written, training courses prepared, support engineers trained and the software drivers for the Harmony library had to be written and tested. As an indication of the work involved, the data sheet and reference manual for the new PIC32MZ micro runs to over 2000 pages. The actual production of the chip is subcontracted by Microchip to TSMC, located in Hsin Chu, Taiwan. TSMC is a “silicon foundry” specialising in the production of semiconductor chips for other companies. These plants can cost billions of dollars to set up which is why companies such as Microchip prefer to outsource the manufacturing process rather than tie up so much capital in a specialist plant. In the final step of production, the raw chips are sent to Microchip’s own facility near Bangkok, Thailand where they are tested, mounted and packaged to make them ready for shipping. It is a truly enormous effort by a world-wide team of engineers and specialists to develop the chip and deliver it into your hands, along with the supporting documentation and software. is intended for less demanding applications. It contains the full MIPS Mk4 32-bit processing core, 128kB of flash memory and 32kB of RAM, along with most other features of the larger PIC32MX line. It comes in a 28-pin dual-in-line package which is easy to solder and can be plugged into an IC socket. It is also very affordable at just US$3.80 in single quantities (direct from Micro chip). The PIC32MX250 is perfect for the hobbyist because it is simple to use yet has most of the power of the 32-bit line. We used this chip in the GPS Tracker published last month and it handled the task with ease and with plenty of capacity to spare. With their sharp prices and performance advantages, Microchip’s 32-bit processors are taking over most of the jobs previously reserved for 16bit processors. In addition, low-cost variants like the PIC32MX250 make a better choice for simple tasks that were previously relegated to the aging but SC similarly priced 8-bit chips. siliconchip.com.au