Skip to content

STM32G030F6P6 I2C problem #1696

Closed Answered by fpistm
Chicco7 asked this question in Q&A
Apr 20, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

I guess you used the Generic G030F6Px variant.
The default the Wire instance is:

// I2C definitions
#ifndef PIN_WIRE_SDA
#define PIN_WIRE_SDA PA10_R
#endif
#ifndef PIN_WIRE_SCL
#define PIN_WIRE_SCL PA9_R
#endif

The _R is for remap pins. So this is normal it does not work by default and this is the normal behavior.
As you want use another pins by default, you can:

  • create your own variant with the desired mapping
  • redefine it a build time using build_opt.h with:
    -DPIN_WIRE_SDA=PB9 -DPIN_WIRE_SCL=PB8
  • change default pins before call the Wire.Begin() (see h…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Chicco7
Comment options

Comment options

You must be logged in to vote
1 reply
@fpistm
Comment options

Answer selected by fpistm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants