Tag Archives: C

PIC32MZ custom SPI Master Communication API Library (Published)

This paper demonstrates how to make SPI (Serial Peripheral Interface) master communication library routines and used those routines to communicate data to and from the PIC32MZ/PIC32 MCUs. Unlike the UART, SPI communication is a synchronous: the master device on an SPI bus creates a separate clock signal that dictates the timing of communication. The device do not have to be configured in advanced to share the same bit rate, and any clock frequency can be used which is within the capabilities of the chips. The SPI bus is a full-duplex bus, which allows communication to flow to and from the master device simultaneously at rate of up to 10Mbps. Typical applications include SD cards, motor controller, SRAM, LCD and sensors. Unfortunately, the microchip PICXC32 compiler does not gives us the SPI master library APIs to call from firmware application layer. This implementation requires PIC32MZ/PIC32 MCU based hardware and microchip MPLAB-X IDE, tool chain and Harmony framework.

Keywords: C, Embedded System, Firmware, PIC32, PIC32MZ, SPI