No SSD1306 libraries working

Mabez
Fri Nov 25, 2016 1:58 pm
Hi,

I am really trying to get my I2C display to work, I originally posted about using u8glib but I cannot get it to work, so I thought just to get it running I would use the two libraries that come with the STMduino cores, the OLED_I2C and adafruits lib. Whats strange is both of these compile using the examples but don’t actually run, by that I mean I have added serial statements through out and they are never seen.

Arduino IDE: 1.6.9
STM32F1 Series – ‘blue pill’

the changed example code:

#include <OLED_I2C.h>

OLED myOLED(SDA, SCL, 8);

extern uint8_t SmallFont[];

void setup()
{
myOLED.begin();
myOLED.setFont(SmallFont);
//randomSeed(analogRead(0));
Serial.begin(9600);
delay(5000);
Serial.println("STARTING!");
}

void loop()
{
int y = random(0, 56);
for (int i=128; i>=-(34*6); i--)
{
myOLED.print("OLED_I2C Scrolling Text Demo ", i, y);
myOLED.update();
Serial.println("In Loop");
delay(50);
}
}


stevestrong
Sat Nov 26, 2016 8:42 am
Try to call serial begin before OLED begin in setup.
Then be sure that you are not using the F() macro to print text.
Furthermore, be sure that you are connecting the serial monitor to the correct port, after the serial re-enumeration on the PC took place.
To wait till serial is available I would recommend the following code:
while ( !Serial.isConnected() ) ;

Mabez
Sat Nov 26, 2016 5:58 pm
Hi Steve,

Thanks for your reply, Serial.isConnected would not compile, and moving Serial.begin(9600) before oled.begin() hasn’t helped, I am definitely on the correct port as if a run a sample sketch with just Serial prints it works fine. This is such a strange problem nothing like anything I’ve seen before and its infuriating :x


stevestrong
Sat Nov 26, 2016 8:16 pm
Mabez wrote: Serial.isConnected() would not compile

david.prentice
Sat Nov 26, 2016 10:11 pm
I tried OLED_I2C_Scrolling_Text example on my Nucleo-F103.

It works if I write the specific constuctor:
//OLED myOLED(SDA, SCL, 8);
OLED myOLED(14, 15, 8); //Hardware I2C pin header on the Nucleo


RogerClark
Sat Nov 26, 2016 10:50 pm
Hi David

Which core are you using , LibMaple or the new STM core.

In Libmaple, the default Wire library (bit banged soft Wire)

#define SDA PB7
#define SCL PB6


david.prentice
Sat Nov 26, 2016 11:24 pm
It seems to be using libmaple. I just installed whatever the defaults were from your website.

If there is an “official” STM build, it seems wise to use that rather than the legacy libmaple.

In fact, the F103 I2C works fine if you use a specific <HardWire.h> constructor and tell it to use the Alternate pins. e.g.
#if defined(ARDUINO_STM_NUCLEO_F103RB)
#include <HardWire.h>
HardWire HWire(1, I2C_REMAP | I2C_FAST_MODE); // I2c1
#define Wire HWire
#else
#include <Wire.h>
#endif


RogerClark
Sat Nov 26, 2016 11:34 pm
The whole LibMaple code base was written by LeafLabs in 2012 to support the Maple mini.

I don’t know how many Nucleo F103 boards are in circulation but only about 5% of the forum members seem to use that board.

The majority use the “Blue Pill” or other generic (no brand) STM32F103 boards, so the LibMaple will not be changed it causes any problems to the 95% of users who don’t use the Nucleo

See https://github.com/stm32duino/BoardManagerFiles for the JSON installer for the official release for Nucleo F103RB and Nucleo L476


Mabez
Sat Nov 26, 2016 11:52 pm
Board : Generic STM32F103CB
Upload type: Serial
Arduino SAM 32 bit board definitions installed, tried on 1.6.9 and 1.6.5

Arduino: 1.6.9 (Windows 10), Board: "Generic STM32F103C series, STM32F103CB (20k RAM. 128k Flash), Serial"

C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\arduino-builder -dump-prefs -logger=machine -hardware "C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\hardware" -hardware "C:\Users\mabez\AppData\Local\Arduino15\packages" -hardware "C:\Users\mabez\Documents\Arduino\hardware" -tools "C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\tools-builder" -tools "C:\Users\mabez\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\libraries" -libraries "C:\Users\mabez\Documents\Arduino\libraries" -fqbn=Arduino_STM32:STM32F1:genericSTM32F103C:device_variant=STM32F103CB,upload_method=serialMethod -ide-version=10609 -build-path "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\mabez\AppData\Local\Temp\arduino_modified_sketch_80355\OLED_I2C_Scrolling_Text.ino"
C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\arduino-builder -compile -logger=machine -hardware "C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\hardware" -hardware "C:\Users\mabez\AppData\Local\Arduino15\packages" -hardware "C:\Users\mabez\Documents\Arduino\hardware" -tools "C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\tools-builder" -tools "C:\Users\mabez\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\libraries" -libraries "C:\Users\mabez\Documents\Arduino\libraries" -fqbn=Arduino_STM32:STM32F1:genericSTM32F103C:device_variant=STM32F103CB,upload_method=serialMethod -ide-version=10609 -build-path "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\mabez\AppData\Local\Temp\arduino_modified_sketch_80355\OLED_I2C_Scrolling_Text.ino"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\sketch\OLED_I2C_Scrolling_Text.ino.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\sketch\OLED_I2C_Scrolling_Text.ino.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C\DefaultFonts.c" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C\OLED_I2C.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C\OLED_I2C.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\sketch\OLED_I2C_Scrolling_Text.ino.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire\HardWire.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire\Wire.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire\WireBase.cpp" -o "nul"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\sketch\OLED_I2C_Scrolling_Text.ino.cpp" -o "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Users\mabez\Downloads\arduino-1.6.9-windows\arduino-1.6.9\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Users\mabez\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C" "-IC:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire" "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\sketch\OLED_I2C_Scrolling_Text.ino.cpp" -o "C:\Users\mabez\AppData\Local\Temp\build1bba08f324dcc027ee3a42cdd38bb0cf.tmp\sketch\OLED_I2C_Scrolling_Text.ino.cpp.o"
C:\Users\mabez\AppData\Local\Temp\arduino_modified_sketch_80355\OLED_I2C_Scrolling_Text.ino: In function 'void setup()':

OLED_I2C_Scrolling_Text:49: error: 'class HardwareSerial' has no member named 'isConnected'

while(!Serial.isConnected());

^

Using library OLED_I2C in folder: C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\OLED_I2C (legacy)
Using library Wire in folder: C:\Users\mabez\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire (legacy)
exit status 1
'class HardwareSerial' has no member named 'isConnected'


RogerClark
Sun Nov 27, 2016 1:03 am
Hardware Serial does not have a function called isConnected, as would be meaningless

There is no way for the hardware serial pins on the device to know if they are connected to anything.

isConnected only applies to Serial USB, and either way this has nothing to do with the OLED lib as it doesnt use isConnected in any of its examples as far as I can tell


stevestrong
Sun Nov 27, 2016 5:28 pm
The strange thing is that the compiler associates the function “isConnected()” with HardwareSerial class instead of USB serial.

Why is that?


david.prentice
Sun Nov 27, 2016 5:58 pm
Probably because the global object: “Serial” has HardwareSerial and not USBSerial class.

David.


stevestrong
Sun Nov 27, 2016 6:33 pm
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):
\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__

RogerClark
Sun Nov 27, 2016 9:02 pm
it seems to be defined twice in your compile line. Which probably means there is a mistake somewhere boards.txt

stevestrong
Mon Nov 28, 2016 8:34 am
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
Mon Nov 28, 2016 10:52 am
@stevstrong

-DMCU_STM32F103CB -DSERIAL_USB


stevestrong
Mon Nov 28, 2016 12:24 pm
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
Mon Nov 28, 2016 12:35 pm
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?


stevestrong
Mon Nov 28, 2016 1:17 pm
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”.


danieleff
Mon Nov 28, 2016 1:28 pm
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.


stevestrong
Mon Nov 28, 2016 1:30 pm
Aha, OK.

Funny, a search for “-DSERIAL_USB” in the guthub repo would not reveal these positions as result.

So now back to the original problem, how can this happen and what is the solution? Is it because of older Arduino version (1.6.9)?


Mabez
Mon Nov 28, 2016 6:51 pm
At this point I have tried it on 1.6.5, 1.6.9 and the latest 1.6.13, none of which work :(

Mabez
Mon Nov 28, 2016 7:04 pm
Looking back at my purchase history I purchased a STM32F103C8T6 blue pill, upon uploading the program detects 128k of flash, which should only be present on the STM32F103CB version. I have tried uploading on both but neither work.

RogerClark
Mon Nov 28, 2016 8:35 pm
danieleff wrote: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.


stevestrong
Tue Nov 29, 2016 9:31 am
Mabez wrote:Looking back at my purchase history I purchased a STM32F103C8T6 blue pill, upon uploading the program detects 128k of flash, which should only be present on the STM32F103CB version. I have tried uploading on both but neither work.

Mabez
Tue Nov 29, 2016 2:07 pm
According to your post here you have selected the wrong target (Board : Generic STM32F103CB).
Instead of F103CB for blue pill you need F103C8, in which case you can still select the 128k version from Arduino menu (the C8 chips have actually 128k flash ;) )
Anyway, the serial USB should be defined in this case too.
If it is still not working, try to add to the end of this line : -DSERIAL_USB, and compile again.

I have tried both, neither make a difference :( . I added the -DSERIAL_USB line and it now compiles with the Serial.isConnected() but still no output on the serial monitor :/


stevestrong
Wed Nov 30, 2016 12:34 pm
Which upload method have you tried? Serial?
This is only useful if you use an extra USB to serial converter board and upload over serial 1. This method is rather appropriate for uploading the bootloader only, but not for normal sw development.

I think you should use the “STM32duino bootloader” method in the Arduino menu.


Mabez
Wed Nov 30, 2016 4:28 pm
I think you should use the “STM32duino bootloader” method in the Arduino menu.
I can’t believe I missed this! Spent this afternoon flashing the bootloader and now the Adafruit library is working! OLED_I2C still doesn’t but I’m not too bothered by that. Thank you very much for your help!

Mabez


stevestrong
Wed Nov 30, 2016 9:09 pm
Welcome, i’m glad that i could help.

umejopa
Thu Jan 26, 2017 10:14 pm
I try this but have to change to Pb8 and Pb9 to get it work.
So software bitbang works .
Will see way dont hardwire dont will work.
Any one thats have it working on 1.8 anduino stm
Jonas

fari
Tue Feb 28, 2017 10:09 am
Hi Jonas!

HWire LIb does not work! refer to my post here
http://www.stm32duino.com/viewtopic.php?f=9&t=1850


BennehBoy
Tue Feb 28, 2017 10:25 am
Apologies if I missed some nuance, I’ve not read the entire thread, just the topic…

However, I am currently driving 8 SSD_1306 libraries via hardware SPI on a Maple Mini without issue.

I am _not_ using the ported Adafruit library supplied with the core. I use the standard Adafruit library.

Code -> https://github.com/BennehBoy/LRDuino


fari
Tue Feb 28, 2017 12:56 pm
Thanks for your feedback! We have got an issue with the I2C Hardware Lib. Have you got a functioning solution

BennehBoy
Tue Feb 28, 2017 2:58 pm
Ah I see, no my solution is SPI only – apologies.

Leave a Reply

Your email address will not be published. Required fields are marked *