Skip to content

PB7 switched with PB9 on G031F8P6 variant  #1527

@danirebollo

Description

@danirebollo

Hi,
I added the variant for G031F8P6 doing the following things:
-putting into packages\framework-arduinoststm32\variants\STM32G0xx\G031F(4-6-8)P_G031Y8Y_G041F(6-8)P_G041Y8Y the ldscript.ld file generated by STM32cube
-modifying generic_clock.c using SystemClock_Config generated by STM32cube in main.cpp
-adding the content of packages\framework-arduinoststm32\variants\STM32G0xx\G031F(4-6-8)P_G031Y8Y_G041F(6-8)P_G041Y8Y/boards_entry.txt to Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\boards.txt

After this my code works but without PB7. And I've noticed that the signal is on PB9.

I've checked the files but I don't found any error... maybe some HAL file is wrong or alternate function problem?

#define ONEWIRE PB_3
#define SENSORIN PA_1
#define LED_R PA_3
#define LED_G PB_7
#define LED_B PA_2
#define THRESHOLD ((4096/2)/2)

bool readSENSOR()
{
  if(analogRead(SENSORIN)>THRESHOLD)
  return true;
  else
  return false;
}

void setup() {
    analogReadResolution(12);
  pinMode(ONEWIRE, OUTPUT);
  pinMode(LED_R, OUTPUT);
  pinMode(LED_G, OUTPUT);
  pinMode(LED_B, OUTPUT);
  pinMode(PB_8, OUTPUT);

    while(1)
  {
    delay(100);
    if(readSENSOR())
    {
        digitalWrite(ONEWIRE, HIGH);
  digitalWrite(LED_R, HIGH);
  digitalWrite(LED_G, HIGH);
  digitalWrite(LED_B, HIGH);
  digitalWrite(PB_8, HIGH);
    }
    else
    {
        digitalWrite(ONEWIRE, LOW);
  digitalWrite(LED_R, LOW);
  digitalWrite(LED_G, LOW);
  digitalWrite(LED_B, LOW);
  digitalWrite(PB_8, LOW);
    }
  }
  
}

void loop() {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions