## No SSD1306 libraries working

Working libraries, libraries being ported and related hardware
stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

### Re: No SSD1306 libraries working

The strange thing is that the compiler associates the function "isConnected()" with HardwareSerial class instead of USB serial.

Why is that?

david.prentice
Posts: 112
Joined: Wed Nov 16, 2016 8:52 am

### Re: No SSD1306 libraries working

Probably because the global object: "Serial" has HardwareSerial and not USBSerial class.

David.

stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

### Re: No SSD1306 libraries working

Normally the Serial is defined as USB serial class.
But it looks like the compiler does not have the option "-DSERIAL_USB", as usual. That's why it seems that the USB serial is not defined at all.
These are the compiler options at compile time in my case (maple mini):

Code: Select all

``\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -DDEBUG_LEVEL=DEBUG_NONE -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_maple_mini -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10612 -DARDUINO_MAPLE_MINI -DARDUINO_ARCH_STM32F1   -DMCU_STM32F103CB -DSERIAL_USB  -mthumb  -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -DSERIAL_USB  -mthumb  -march=armv7-m -D__STM32F1__``
This is different from that of @Mabez.

RogerClark
Posts: 6877
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

### Re: No SSD1306 libraries working

it seems to be defined twice in your compile line. Which probably means there is a mistake somewhere boards.txt

stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

### Re: No SSD1306 libraries working

In boards.txt it is extra defined for Maple mini, but not for generic (blue pill).
However, the compiler gets this option from other place, too. Where from?

RogerClark
Posts: 6877
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

### Re: No SSD1306 libraries working

@stevstrong

Code: Select all

``-DMCU_STM32F103CB -DSERIAL_USB``

appears twice in the text you posted

But doesnt seem to have this when I compile for the F103C

What board and upload method did you select ?

stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

### Re: No SSD1306 libraries working

Roger, as one can detect from the compiler options, I was using maple mini. The part you pointed can be found in boards.txt.
For the F103C generic there is no such an option.

But I would like to know where else is the compiler option "-DSERIAL_USB" defined?

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

### Re: No SSD1306 libraries working

stevestrong wrote:Roger, as one can detect from the compiler options, I was using maple mini. The part you pointed can be found in boards.txt.
For the F103C generic there is no such an option.

But I would like to know where else is the compiler option "-DSERIAL_USB" defined?
It is defined only once. But it is passed to the compiler twice, once in build.extra_flags, and once in build.cpu_flags, platform.txt lines 47 and 81.

stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

### Re: No SSD1306 libraries working

For F103C, I could not find where the "-DSERIAL_USB" is defined, still seems to be used by the compiler, since F103C generic uses the USB serial.
So, once again, I would like to know why.

EDIT
The serial USB is compiled only if the USB serial (DFU) upload method is chosen in the Arduino menu, according to this link.

So, I think that if one need the serial USB independent from the upload method, then he should change the boards.txt file and add the extra options "build.cpu_flags=-DMCU_STM32F103CB -DSERIAL_USB".
Last edited by stevestrong on Mon Nov 28, 2016 1:28 pm, edited 1 time in total.

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

### Re: No SSD1306 libraries working

stevestrong wrote:For F103C, I could not find where the "-DSERIAL_USB" is defined, still seems to be used by the compiler, since F103C generic uses the USB serial.
So, once again, I would like to know why.

EDIT
The serial USB is compiled only if the USB serial (DFU) upload method is chosen in the Arduino menu, according to this link.