Im currently working on a prototype ATMEGA328 project and i’m a.) running out of pins b.) worry about SPI
I have do communicate with two SPI-Devices (SD-Card Mode 0) and (Display Mode 3). So to communicate i need to completly shut down communciation, change spi mode, and then restart with different values.
So i looked at STM32F103CB, which is used on mapple boards. It is not that much more expensive than an Mega328, and comes with 2 SPI. Are they supported by Arduino? Can i connect the SD Card on SPI1, and Display on SPI2? ![]()
I also need 2 pins for a GPS, that usually works by the SoftwareSerial library. And i need 1x I2C as well.
Is it possible?
Here is my application:
This is the code in the .ino file of a example program written for arduino uno.
DOG.initialize(10,0,0,9,4,DOGM128); //SS = 10, 0,0= use Hardware SPI, 9 = A0, 4 = RESET, EA DOGM128-6 (=128x64 dots)
repeat using github, maybe search for stm32f1 or stm32f, look at those repo’s that use your hardware or similar hardware
searching arduino on github is probably not a good idea – “We’ve found 72,931 repository results”
list the hardware you’ve got and/or thinking of getting
interfaces – list them and then for each, list the devices attached
are there arduino libraries for each and is there a stm32 port ( teensy / due / a.n.other) of those ?
dog128 is a display and there’s a tft or lcd mega package istr that has it in, rikki?? u8glib or utft ?? ?? ??
when you have that lot sorted out, then we might be able to help further.
btw if this is homework or a school / college / uni project – all bets are off.
stephen
The manufacturer of the DOG128 provided a working library for the arduino boards. See library attached
The code sniped i attached is from that library. My question is, if this would work with the second SPI port of the STM32. I have read about the SD-Card library not working with the stm32, because SPI1 is hardcoded in library and must be changed.
The display’s are expensive, so just buy and try it is the last option ![]()
Hadware i want to use: STM32F103 Chip, soldered to my own pcb
Interfaces: SPI: SD Card , SPI2: DOG128 Display, I2C: EEPROM,RTC, UART: to FT232 and then serial monitor
This is not for school or so, its for hobby. I usually use mega328, but in this project i need 2 SPI and more pins, so i’m looking at the STM32F103 since i can arduino code on there and its not really much more expensive than Mega328
The manufacturer of the DOG128 provided a working library for the arduino boards. See library attached
The code sniped i attached is from that library. My question is, if this would work with the second SPI port of the STM32. I have read about the SD-Card library not working with the stm32, because SPI1 is hardcoded in library and must be changed.
The display’s are expensive, so just buy and try it is the last option ![]()
Hadware i want to use: STM32F103 Chip, soldered to my own pcb
Interfaces: SPI: SD Card , SPI2: DOG128 Display, I2C: EEPROM,RTC, UART: to FT232 and then serial monitor
This is not for school or so, its for hobby. I usually use mega328, but in this project i need 2 SPI and more pins, so i’m looking at the STM32F103 since i can arduino code on there and its not really much more expensive than Mega328
Obviously that doesn’t answer the library question directly, but if your screen library has a sw SPI option it’s more likely to work than HW imho.
Why that choice of display? SSD1306 OLED displays are super cheap, bright, great viewing angles, and 128×64 pixels are readily available.

![[Pending Enhancement] RTC values resetting](https://sparklogic.ru/wp-content/uploads/2019/11/nucleo-l476rg-zestaw-startowy-z-mikrokontrolerem-z-rodziny-stm32-stm32l476-90x90.jpg)