Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genericSTM32F405RG serial not working #540

Closed
JyeSmith opened this issue Jul 3, 2021 · 1 comment
Closed

genericSTM32F405RG serial not working #540

JyeSmith opened this issue Jul 3, 2021 · 1 comment

Comments

@JyeSmith
Copy link

JyeSmith commented Jul 3, 2021

Hi,

Im having an problems with serial on the F405. Below is the ini and script. The bluepill works as expected, and changing to the F405 results in the led blinking but no serial.

Serial upload works as expected with uart1 (PA9 and PA10) on both targets

Is there something Im missing? or an actual issue?

Cheers

[env:dev]
platform = ststm32@14.0.1
framework = arduino
; board = genericSTM32F103C8
board = genericSTM32F405RG
upload_protocol = serial
monitor_speed = 9600
#include <Arduino.h>

// #define LEDPIN PC13 // genericSTM32F103C8
#define LEDPIN PA8 // genericSTM32F405RG

void setup() {
  Serial.setTx(PA9);
  Serial.setRx(PA10);
  Serial.begin(9600); 
  pinMode(LEDPIN, OUTPUT);
}

void loop() {
  Serial.println("Hello World!");  
  digitalWrite(LEDPIN, HIGH);
  delay(250);
  digitalWrite(LEDPIN, LOW);
  delay(250);
}
@JyeSmith
Copy link
Author

JyeSmith commented Jul 9, 2021

I got the below working 👍

.ini

[env:dev]
    platform = ststm32@14.0.1
    framework = arduino
    board = genericSTM32F405RG
    upload_protocol = serial
    monitor_speed = 9600
    build_flags = 
       -DSERIAL_UART_INSTANCE=1
       -DPIN_SERIAL_RX=PA10
       -DPIN_SERIAL_TX=PA9
       -D HSE_VALUE=8000000U

.cpp

#include <Arduino.h>

    #define LEDPIN PA8 // genericSTM32F405RG

    // #define GPIO_PIN_RCSIGNAL_TX_1 PA9
    // #define GPIO_PIN_RCSIGNAL_RX_1 PA10

    #define GPIO_PIN_RCSIGNAL_TX_3 PB10
    #define GPIO_PIN_RCSIGNAL_RX_3 PB11

    #define GPIO_PIN_RCSIGNAL_TX_6 PC6
    #define GPIO_PIN_RCSIGNAL_RX_6 PC7

    HardwareSerial SerialPort(1);

    // HardwareSerial Port1 = SerialPort;
    HardwareSerial Port3 = SerialPort;
    HardwareSerial Port6 = SerialPort;

    void setup() {
      pinMode(LEDPIN, OUTPUT);

      Serial.begin(9600); 

        // Port1.setTx(GPIO_PIN_RCSIGNAL_TX_1);
        // Port1.setRx(GPIO_PIN_RCSIGNAL_RX_1);
        // Port1.begin(9600);  

        Port3.setTx(GPIO_PIN_RCSIGNAL_TX_3);
        Port3.setRx(GPIO_PIN_RCSIGNAL_RX_3);
        Port3.begin(9600);
     

        Port6.setTx(GPIO_PIN_RCSIGNAL_TX_6);
        Port6.setRx(GPIO_PIN_RCSIGNAL_RX_6);
        Port6.begin(9600);
    }

    void loop() {
      Serial.println("UART1");  
      // Port1.println("Port 1");  
      Port3.println("Port 3");  
      Port6.println("Port 6");  

      digitalWrite(LEDPIN, HIGH);
      delay(250);
      digitalWrite(LEDPIN, LOW);
      delay(250);
    }

@JyeSmith JyeSmith closed this as completed Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant