alternative way to use STM DFU in Arduino 1.8.3 on Black F407VET6

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
poiuycat
Posts: 17
Joined: Tue Aug 22, 2017 4:53 pm

Re: alternative way to use STM DFU in Arduino 1.8.3 on Black F407VET6

Post by poiuycat » Fri Oct 06, 2017 3:51 pm

this is my sample code and I found if I close the serial monitor few minute the program will stop blinking when I open the monitor it will continue run.
I thing is because of the usb serial buffer full or what ... is this a bug or normal ? how do I check the usb buffer is full when that is unable to send out the data ? because normally HW serial system wont care the user is received the data or not but USB ?

Code: Select all

byte LED_BUILTIN2 = PA7;
byte LED_BUILTIN1 = PA6;
// the setup function runs once when you press reset or power the board
void setup() {
  //setupUSB();
  // initialize digital pin LED_BUILTIN as an output.
  //delay(3000);
  SerialUSB.begin(115200);
  //delay(3000);
  SerialUSB.println("OK!!");
  
  pinMode(LED_BUILTIN1, OUTPUT);
  pinMode(LED_BUILTIN2, OUTPUT);
  
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN2, HIGH);   // turn the LED on (HIGH is the voltage level)
  SerialUSB.println("OK!!");
  delay(100);                       // wait for a second
  digitalWrite(LED_BUILTIN1, HIGH);    // turn the LED off by making the voltage LOW
  SerialUSB.println("OK!!");
  delay(100);                       // wait for a second
  digitalWrite(LED_BUILTIN2, LOW);   // turn the LED on (HIGH is the voltage level)
  SerialUSB.println("OK!!");
  delay(100);                       // wait for a second
  digitalWrite(LED_BUILTIN1, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                       // wait for a second

  
}

stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: alternative way to use STM DFU in Arduino 1.8.3 on Black F407VET6

Post by stevestrong » Fri Oct 06, 2017 4:09 pm

poiuycat wrote:after few round of test and yes it work on you repo but not work on Roger's repo
Strange.
Anyway, I created a PR in order to avoid repeated call of USB serial: https://github.com/rogerclarkmelbourne/ ... /354/files
Hopefully will be merged by Roger soon.
Meanwhile you could try to get this version to see if it works better now.

Regarding the USB serial Tx buffer, yes, currently it seems to be a "bug" which blocks the main loop as long as the Tx buffer is full.
I recorded already this issue here: https://github.com/rogerclarkmelbourne/ ... issues/306
I currently don't have the time to solve this, I marked this to "low prio" as it is not critical for me.
Any contribution to solve this issue is welcome.

Post Reply