One more thing worth noting, I was having some trouble with the Serial port right after I got the LED blinky working. As soon as I included a printf in my code, the whole thing would hang! LED stopped blinking, nothing was happening on the serial port. After checking the data sheet, this was because PA_2 and PA_3 (tx and rx) were set up to be UART_2 on the Nucleo board, but with my STM32F030K6, PA_2 and PA_3 were set up to be UART_1. I was able to change this in the serial_api.c file in the mbed-src directory.
static const PinMap PinMap_UART_TX[] = {
//{PA_2, UART_2, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},
{PA_2, UART_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},//new
{PA_9, UART_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},
{PB_6, UART_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_0)},
{NC, NC, 0}
};
static const PinMap PinMap_UART_RX[] = {
//{PA_3, UART_2, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},
{PA_3, UART_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},//new
{PA_10, UART_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},
{PA_15, UART_2, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_1)},
{PB_7, UART_1, STM_PIN_DATA(GPIO_Mode_AF, GPIO_OType_PP, GPIO_PuPd_UP, GPIO_AF_0)},
{NC, NC, 0}
};
I also had to make sure that GPIO_AF_1 was the right 'alternate function' to select for PA_2 and PA_3 to be configured as UARTs. I'm assuming I'll have to make similar changes for SPI and I2C. Hopefully this helps someone down the road.
I just received some PCBs back from fabrication and assembly, and I'm trying to flash over a basic "hello world" type application to verify its functionality. I'm having trouble flashing the binary, however. The design is based on the STM32F030 Nucleo Board. It's worth mentioning that I'm using the 32 pin version of the STM32F030 MCU (STM32F030K6), and not the 64 pin version, which is what's on board the Nucleo. I'm not sure if that means I need to change some things in mbed.h because of the slightly different pinout.
According to section 5.3.4 of the user manual for the Nucleo boards UM1724, it *should* be as simple as removing the jumpers on CN2, and connecting the ST-Link Header to the ST-Link Header on my board. It's worth noting that the SWO signal is 'reserved for future use', and there wasn't anywhere to connect it to on the STM32 chip.
I connected everything as indicated in UM1724. Here's a few pictures. PCB with header connected, PCB and ST-Link
Note that the LEDs on the green PCB (my board) are just power/battery charger indicators. The LEDs connected to the STM32F030 are along the center of the board.
Typically when I flash a program to a Nucleo board, I drag the binary over to the Nucleo drive that shows up like a USB. The drive will typically close, and when I open, the binary no longer appears on the 'drive', as it has been flashed over to the Nucleo MCU. I've been having no such luck with the ST-Link header from the Nucleo Board and my custom PCB. When I drag the binary over, it just sits there. The window doesn't automatically close, and nothing happens on my PCB. I checked the terminal window, and nothing is being sent over UART either. Here's a video of what I mean.
Here's the program, for reference. It's just supposed to flash an LED (I have an LED connected to PB_5), and send something over via serial.
Here's my schematic of the MCU portion of my design along with the programming header. Schematic. The data sheet for the STM32F030K6 is located here.
Any advice would be helpful in debugging this problem, I'm not sure why it's not flashing over. Maybe it's not resetting or something?
Thanks.