#include <Wire.h>
HardWire HWire(1, I2C_FAST_MODE); // I2c1
void setup() {
Serial.begin(115200);
while(!Serial); delay(1000);
HWire.begin();
Serial.println("\nI2C Scanner");
}
uint32_t counter;
void loop() {
byte error, address;
int nDevices;
Serial.print(counter++);
Serial.println(": Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
HWire.beginTransmission(address);
error = HWire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
nDevices++;
}
else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found");
else
Serial.println("done");
delay(5000); // wait 5 seconds for next scan
}
Normally, the Arduino_STM32 folder should be located under \Documents\Arduino\hardware.
Also see http://wiki.stm32duino.com/index.php?title=Installation.
Which board have you selected?
Upload method?
Also, please replace HardWire by TwoWire.
In file included from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/usb.h:8:0,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/usb_serial.h:34,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/wirish.h:50,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\system/libmaple/Arduino.h:31,
from sketch\i2c_scanner_hardwire.ino.cpp:1:
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/VCP/usb_conf.h:29:22: error: conflicting declaration 'typedef unsigned int uint32_t'
typedef unsigned int uint32_t;
^
In file included from c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\lib\gcc\arm-none-eabi\4.8.3\include\stdint.h:9:0,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/wirish.h:38,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\system/libmaple/Arduino.h:31,
from sketch\i2c_scanner_hardwire.ino.cpp:1:
c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdint.h:66:20: error: 'uint32_t' has a previous declaration as 'typedef __uint32_t uint32_t'
typedef __uint32_t uint32_t ;
^
exit status 1
Unfortunately, the compiler internal definition (unsigned long) does not match the core definition (unsigned int) for uint32_t.
Alternative solutions:
1. – change/comment out this line https://github.com/stevstrong/Arduino_S … conf.h#L29
or
2. – change the compiler definition in c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdint.h:66 to unsigned int
I applied solution nr 2. on my PC.
-Download and install the version 1.8.5 of the Arduino IDE.
-Run the IDE, and on the Tools menu, select the Boards manager, and install the Arduino SAM boards (Cortex-M3) from the list of available boards.
-Download zip file containing the STM32 files .
-Unzip to create the Arduino_STM32 folder.
– Copy the Arduino_STM32 folder to My Documents/Arduino/hardware (Note: if the hardware folder doesn’t exist you will need to create it).
-Re-start the Arduino IDE.
Аnd now when you select any Board stm32 does not compile even an empty sketch. Throws errors.
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdint.h:66
In file included from c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\lib\gcc\arm-none-eabi\4.8.3\include\stdint.h:9:0,
from c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\inttypes.h:17,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/libmaple_types.h:36,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_OTG_Driver/inc/usb_regs.h:28,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_OTG_Driver/inc/usb_core.h:28,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_OTG_Driver/inc/usb_dcd.h:27,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Core/inc/usbd_core.h:27,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h:29,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Class/cdc/inc/usbd_cdc_core.h:27,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\usbF4\usb.c:5:
c:\users\user-2\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdint.h:67:22: error: conflicting types for 'uint32_t'
typedef unsigned int uint32_t;
^
In file included from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/VCP/usbd_conf.h:28:0,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Core/inc/usbd_def.h:27,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h:28,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Class/cdc/inc/usbd_cdc_core.h:27,
from C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\usbF4\usb.c:5:
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/VCP/usb_conf.h:29:24: note: previous declaration of 'uint32_t' was here
typedef unsigned long uint32_t;
^
exit status 1
//typedef __uint16_t unsigned int ;
typedef unsigned int uint32_t;
In my repo that line looks different: https://github.com/stevstrong/Arduino_S … conf.h#L29.
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:1: error: 'ETH_REF_CLK' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:14: error: 'ETH_MDIO' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:24: error: 'ETH_CRS_DV' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:36: error: 'ETH_TX_EN' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:47: error: 'ETH_TX_D0' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:58: error: 'ETH_TX_D1' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:69: error: 'ETH_MDC' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:78: error: 'ETH_RX_D0' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\ethernet.c:14:89: error: 'ETH_RX_D1' undeclared here (not in a function)
ETH_REF_CLK, ETH_MDIO, ETH_CRS_DV, ETH_TX_EN, ETH_TX_D0, ETH_TX_D1, ETH_MDC, ETH_RX_D0, ETH_RX_D1
^
exit status 1
Please get the new version from github.
For bugs you can also start an issue on github.
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\rccF4.c: In function 'rcc_clk_init':
C:\Users\user-2\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple\libmaple\rccF4.c:463:6: error: #elif with no expression
#elif
^
exit status 1
But I corrected it (replaced #elif with #else) anyway. Thanks for reporting.
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
}
Although this board is present in the repo, but is actually not tested, and I am not sure whether it has direct USB serial connection feature or not.
The main target of my F4 repo are the F407 generic boards (black and mini VET6) and Arch max v1.1, so that I cannot guarantee that any other board will work.
Also note that the USB serial feature can be selected in the Arduino IDE menu.
For VGT6 I would suggest to either clone my repo and make a new VGT6 board variant based on VET6, or submit a PR with the newly generated variant.
#include "Wire.h"
TwoWire HWire(1, I2C_FAST_MODE); // I2c1
// optionally, it is possible to use the default declared Wire(1) instance with normal speed
//#define HWire Wire
void setup() {
Serial.begin(115200);
while(!Serial); delay(1000);
HWire.begin();
Serial.println("\nI2C Scanner");
}
uint32_t counter;
void loop() {
byte error, address;
int nDevices;
Serial.print(counter++);
Serial.println(": Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
HWire.beginTransmission(address);
error = HWire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
nDevices++;
}
else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found");
else
Serial.println("done");
delay(5000); // wait 5 seconds for next scan
}
I have corrected this, please check it out again.

[BennehBoy – Thu Feb 14, 2019 1:43 pm] –
STM core has VGT6 in the new 1.5.0 release, along with USB CDC (Serial), i2c works.
Steve’s F4 is not going away and he has indicated that bug-fixes will be managed via github after this forum shuts down.
I’m a serious pusher for users to move to the STM Official Core, but there will be users that will stay with Roger’s F1 and Steve’s F4 based upon their needs. Roger has not indicated to me that he will continue to do break-fix on the F1 after April 27th.
IMHO, having Steve’s F4 maintained into the future is far more important as it offers a lean migration path from F1 to F4 … important for end-users pushing the limits of the F1 today.
Ray