Figgering Out the Differences

Post here first, or if you can't find a relevant section!
Post Reply
g0mgx
Posts: 9
Joined: Fri Jan 10, 2020 1:41 pm

Figgering Out the Differences

Post by g0mgx »

Hi Team

I'm having great success using the Arduino IDE and STM32 boards from various sources; however one large bit of total confusion remains. I'm hoping very much that someone far cleverer than I can explain to me in a simple way.

There are two different board manager entries that include the STM32F103C "Blue Pill" board:

http://dan.drown.org/stm32duino/package ... index.json

https://github.com/stm32duino/BoardMana ... index.json

It seems I can use the HID bootloader from here:

https://github.com/Serasidis/STM32_HID_ ... r/releases

with the first set of board selections, but not the second. I have also tried a larger bootloader file I downloaded from the description of this YouTube video:

https://youtu.be/Tm7IWQLrKYs

This works with the "Generic STM32F103C series" from the board manager entries i.e. the second pacakge listed above.

I'm totally confused as to the differences between them, why the bootloaders are specific to the baord selection, and most importantly why some example code I have will only compile with one selection and not the other.

Can anyone explain to me?

Most recently I was trying to use a touchscreen which was on the SPI2 interface.

The example code I have does this:

Code: Select all

// Create an SPI instance on SPI2 port.
// this is for the touch screen functionality
SPIClass mySPI(2); 
// now declare the touchsereen
// Chip Select pin, SPI port
XPT2046_touch ts(CS_PIN, mySPI); 
Which will only compile on one of the two board selections.

I'm very confused.

Mark

Mark
G0MGX

stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: Figgering Out the Differences

Post by stas2z »

defining spi instance should be done a bit different for second core
as basic arduino atmega boards never had multiple spi's there is no standard way for multiple spi instances defining

for second core you can use constructor SPIClass mySPI(MOSI_PIN, MISO_PIN, CLK_PIN, CS_PIN);
where *_PIN are your board SPI2 pins
CS_PIN can be NC if you want your lcd library to manage it

stevestrong
Posts: 357
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 7
Location: Munich, Germany
Contact:

Re: Figgering Out the Differences

Post by stevestrong »

Those two board manager entries point to two different cores (basic set of files for Arduino framework).
The first is the Libmaple (aka Roger's) core which supports upload via DFU and HID bootloaders.
This is same as used in the youtube video.

The second points to the official STM core which I don't know if it supports those bootloaders.

The board selection is different for the two cores.
Selecting one board you select per default one underlying core.
The "Generic STM32F103C series" board selection is part of the Libmaple core.

User avatar
fpiSTM
Posts: 789
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 30
Location: Le Mans
Contact:

Re: Figgering Out the Differences

Post by fpiSTM »

stevestrong wrote:
Sun Mar 22, 2020 9:05 am

The second points to the official STM core which I don't know if it supports those bootloaders.
Yes they are supported.

rikysuhendra
Posts: 2
Joined: Sun Sep 13, 2020 4:26 am

STM32F103C FROM SPI-1 TO SPI-2

Post by rikysuhendra »

[ENGLISH]
Hello,

I want to share what I experienced in making the system
who implemented STM32F103C [STM32F103C8T6] stm32duino

in 2019,
Initially, I used the Arduino IDE v.1.5.x software
and using EThernet_STM.h
but because of the design needs that require A0-A9 as a digital input
10-bit absolute rotary sensor, then SPI must be moved from SPI-1 to SPI-2
in this condition I modify the W550.cpp to be like this
C: \ Users \ [your PC] \ AppData \ Local \ Arduino15 \ packages \ stm32duino \ hardware \ STM32F1 \ 2019.12.31 \ libraries \ Ethernet_STM \ src \ utility
-------------------------------------------------- -------------
#include <stdio.h>
#include <string.h>
#include <SPI.h> // add by riky

#include "utility / w5100.h"
#if defined (W5500_ETHERNET_SHIELD)

// W5500 controller instance
W5500Class W5100;

#define SPI_CS 10
// # define STM32_SPI_CS PA4 // edit by riky
#define STM32_SPI_CS PB12 // change by riky
// # define SPI2_NSS_PIN PB12 // add by riky
SPIClass SPI_2 (2); // add by riky

void W5500Class :: init (void)
....
..
etc
-------------------------------------------------- -------------

but after I upgraded the Arduino IDE 1.5.x to v.18.x
can no longer ... :(
so I have to do more, and pray to the Lord Jesus
... finally God showed me a directory and a file
and directs me to have to modify the variant.h file that's in
C: \ Users \ [yourPC] \ AppData \ Local \ Arduino15 \ packages \ STM32 \ hardware \ stm32 \ 1.8.0 \ variants \ PILL_F103XX

on the line: [the standard is SPI-1]

// SPI Definitions
#define PIN_SPI_SS PA4
#define PIN_SPI_MOSI PA7
#define PIN_SPI_MISO PA6
#define PIN_SPI_SCK PA5

change to: [SPI-2]

// SPI Definitions
#define PIN_SPI_SS PB12
#define PIN_SPI_MOSI PB15
#define PIN_SPI_MISO PB14
#define PIN_SPI_SCK PB13


and change from Ethernet_STM.h to Ethernet.h

Hallelujah ... Praise God
works ... :)

ok, hope it's useful
Lord Jesus bless you and your family so much - so much - so much
amen!

[INDONESIA]
Halo,

saya mau berbagi apa yang saya alami dalam membuat system
yang menerapkan STM32F103C [STM32F103C8T6] stm32duino

pada tahun 2019,
awalnya, saya mengunakan software Arduino IDE v.1.5.x
dan mengunakan EThernet_STM.h
namun karena kebutuhan design yang membutuhkan A0-A9 sebagai digital input
10-bit absolute rotary sensor, maka SPI harus dipindahkan dari SPI-1 ke SPI-2
pada kondisi ini saya memodifikasi W550.cpp menjadi seperti berikut
C:\Users\[your PC]\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2019.12.31\libraries\Ethernet_STM\src\utility
---------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <SPI.h> //add by riky

#include "utility/w5100.h"
#if defined(W5500_ETHERNET_SHIELD)

// W5500 controller instance
W5500Class W5100;

#define SPI_CS 10
//#define STM32_SPI_CS PA4 //edit by riky
#define STM32_SPI_CS PB12 //change by riky
//#define SPI2_NSS_PIN PB12 //add by riky
SPIClass SPI_2(2); //add by riky

void W5500Class::init(void)
....
..
dan seterusnya
---------------------------------------------------------------

tetapi setelah saya upgrade Arduino IDE 1.5.x menjadi v.18.x
sudah tidak bisa lagi... :(
jadi saya harus ngoprek lagi, dan berdoa kepada Tuhan Yesus
...akhirnya Tuhan tunjukan ke saya suatu direktroy dan file
dan mengarahkan saya harus memodifikasi file variant.h yang ada di
C:\Users\[yourPC]\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\variants\PILL_F103XX

pada baris: [standard nya SPI-1]

// SPI Definitions
#define PIN_SPI_SS PA4
#define PIN_SPI_MOSI PA7
#define PIN_SPI_MISO PA6
#define PIN_SPI_SCK PA5

rubah menjadi : [SPI-2]

// SPI Definitions
#define PIN_SPI_SS PB12
#define PIN_SPI_MOSI PB15
#define PIN_SPI_MISO PB14
#define PIN_SPI_SCK PB13


dan mengganti dari Ethernet_STM.h menjadi Ethernet.h

Haleluya...Puji Tuhan
berhasil...:)

ok, semoga bermanfaat
Tuhan Yesus memberkati anda sekeluarga berlimpah-limpah-limpah
amin!

User avatar
Juraj
Posts: 28
Joined: Fri Jan 03, 2020 7:47 pm
Answers: 1
Location: Slovakia
Contact:

Re: Figgering Out the Differences

Post by Juraj »

@rikysuhendra , in old IDE you had Roger's core and in the new IDE installation you have the core by STM

mrburnette
Posts: 301
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: Figgering Out the Differences

Post by mrburnette »

https://stm32duinoforum.com/forum/viewt ... _3111.html

The above link will take you to a basic explanation. the current "STM32DUINOFORUM.com" once was "stm32duino.com" before the great 2019 crash.

STM32DUINOFORUM.com is a partial restore of Roger's STM32duino.com ... many links are dead.

The current stm32duino.com site is owned by STM.

Code: Select all

The timeline:

leaflabs.com  -----------------------------> Roger Clark's Enhancements  -----> xx CRASH XX -----> STM32 Corporate
http://forums.leaflabs.com/forums                    stm32duino.com         stm32duinoforum.com      stm32duino.com

Post Reply

Return to “General discussion”