Post comments on this article and find any associated files and/or downloads at
■ Screenshot 2. This screen capture leaves no
doubt that our application of the JumpStart API is
working as designed. Don’t get too excited about
the time stamps. These times are relative to the
terminal emulator, not our STM32F030R8T6
Sys Tick timer.
The SPI CS pin is not datasheet assigned. So, PB6 is just as
good as any here. The CS pin is configured as
active low. I have plans for this SPI portal. So, for
now, we will configure it as an eight-bit portal
running in SPI mode 0 at 400 kHz. SPI mode 0
equates to a clocked data stream with phase low
(CPHA = 0) and polarity low (CPOL = 0). Now
that we have defined, configured, and activated
our SPI portal, the JumpStart API supports it with a
load of SPI data transfer calls.
mount the Pmod. The USART program compiled without
error. A debug session was kicked off with the J-Link PRO
connected to the STM32F030R8T6. I fired up the CCS
For instance, we can send eight bits of data to an SPI
slave with this JumpStart API call:
SIOW terminal emulator and configured it for 9600 baud.
Once the emulator came up, I was presented with a pair
of green LED status indicators on the J-Link PRO and a
blinking transmit LED on the Pmod. Screenshot 2 confirms
our success with the ARM USART.
&porta, 5, 0, // SCK
&porta, 7, 0, // MOSI
&porta, 6, 0, // MISO
&portb, 6, // CS
true // active LOW
spi1.MakeSPI(8, 0, 400000);
bite = spi1.Write(data);
As you can see, the spi1.Write call also returns a byte
of information from the slave. If the application calls for 16
bits per transfer, all we have to do is alter our
spi1.MadeSPI call like this:
Now that we have established a working USART
portal that we can use as a debug tool, let’s bring up
another important communications port we all know as
the SPI portal. We shall begin by consulting the
spi1.MakeSPI(16, 0, 400000);
Controlling the SPI chip select (CS) line is also
covered by the JumpStart API:
STM32F030R8T6 datasheet and laying out the SPI MOSI,
MISO, SCLK, and CS pins:
spi1.ChipSelect(); //CS = low
spi1.ChipDeselect(); //CS = high
Remember that I stated earlier that I had a “plan” for
our SPI portal?
The STM32F030R8T6 datasheet tells us that the SPI1
pins are located on PORTA in AF0 (Alternate Function 0).
The reconnaissance data captured in Photo 3 reveals
that a microSD card socket and associated components
have been added to our STM32F030R8T6 ARM complex.
The microSD card socket assembly is mounted on top of
the six-pin Pmod access socket. Everything is wired in
using point-to-point techniques. Schematic
1 outlines the attachment of the 20-pin
JTAG programming/debugging header.
The microSD circuitry is outlined
graphically in Schematic 2. The tristate
buffer in the design provides output
buffering, as well as isolation from the
STM32F030R8T6’s SPI MISO line.
The microSD’s MISO and CS signals
should be pulled up, and we have done
■ Photo 3. The microSD card socket and buffer circuitry are
mounted on top of the Pmod six-pin socket.
52 March 2016