question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Program not exiting flash function after successfully uploading hex file

See original GitHub issue

Description

I use macOS Catalina and was looking for an easy way to flash games on my Arduboy and came across your (awesome!) library. I’d like to use it to develop a new app to manage my game library, which is a bunch of hex files.

As a start, I installed the NPM package in a folder and added this index.js which I adapted from your README:

var Avrgirl = require('avrgirl-arduino');

var avrgirl = new Avrgirl({
  board: 'leonardo',
  debug: true
});

avrgirl.flash('pong.hex', function (error) {
  if (error) {
    console.error(error);
  } else {
    console.info('done.');
  }
});

The hex file is attached as a zip, just because lol. While the script successfully flashes the hex file, the node program does not quit. This is the output I see in my console:

marcussanatan@Marcuss-MacBook-Pro arduboy-upload % node index.js                        
resetting board...
found port on /dev/tty.usbmodem14201
reset complete.
connected
flashing, please wait...
flash complete.
done.
^C
marcussanatan@Marcuss-MacBook-Pro arduboy-upload % 

Note the ^C as I have to manually interrupt the program to get back to my shell. The “done” messaged was logged to the screen, further confirmation that the flashing did not encounter an error. However, it seems as though the script is “stuck” in the callback.

I was curious if this occurred in earlier versions. I deleted node_modules and package-lock.json and installed version 4.2.1. When I ran my script again, it just works:

marcussanatan@Marcuss-MacBook-Pro arduboy-upload % node index.js                        
resetting board...
found port on /dev/tty.usbmodem14201
reset complete.
connected
flashing, please wait...
flash complete.
done.
marcussanatan@Marcuss-MacBook-Pro arduboy-upload % 

I’ll try to deep dive when I have more time this week, but I took a look at the differences between 4.2.1 and 4.2.2. Most of it involves web serial updates except for d2287d87bbc6ba94040e4330a52cc867f684bf53 which is a patch for issue #193. Time permitting I’ll confirm in the next couple of days but it feels like the culprit.

Expected behaviour

I expected the Node.js program to quit after the hex file was flashed

Actual behaviour

The Node.js program is blocked when I call the flash() function.

Operating system and version

Linux and Unix based systems

Darwin Marcuss-MacBook-Pro.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64

Haven’t confirmed on other OSes.

Avrgirl Arduino version

avrgirl-arduino@4.2.2

NodeJS version

v13.3.0

Arduino Board being used

Arduboy (leonardo)

pong.hex.zip

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
noopkatcommented, May 17, 2020

@msanatan thank you so much for your kind words about this project, despite it being a little bit buggy for you 😅

I would love any PRs in general even if they’re not related to this problem. I just moved house last week so I’m still trying to get back on top of my open source work 📦

I should be able to get to this issue in particular pretty soon 🤞

1reaction
noopkatcommented, May 3, 2020

Hi @msanatan, Thanks for flagging this, as I was interested in whether or not this is something that affects how people use the library for their projects.

Just for history, this library has always had this bug until 4.2.1 as you were able to track down, as you mentioned due to #193. Given that this bug is still going to be a thing going forward for certain operating systems, I need to work in a more sophisticated fix. In the meantime, I would recommend just using v 4.2.1 for now especially if everything else in that version is working as expected.

Stay tuned for a proper fix soon, likely in a version 4.2.3?

BTW it’s really cool to see that you’re using this for the Arduboy! I love that board a lot and am happy to hear that people are still using it. It’s always kinda needed an easy ROM loader, so I’m glad you worked on a solution that works for you 😄

Thanks again for your kind words and generosity towards this project! 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem Occurred Error while uploading code .hex file to ...
Today, when I tried to upload .hex file to board, it shows this error. ... from target flash. Could not get MCU info,...
Read more >
Cannot flash ARM device - "The Intel Hex file does not start ...
From the error message you are getting, your programming tool is expecting a file in Intel Hex format. · The file you are...
Read more >
Arduino IDE not working after dumping .hex file using AVR dude
Now after the dump was successful. As i need some changes in code .If i go back to Arduino IDE to upload file...
Read more >
Attempting to generate .hex file in order to flash with UniFlash ...
We have operational software, working with CCS, that I would like for a remote colleague to be able to flash using UniFlash with...
Read more >
IPE v5.25 Problems flashing ATmega3208
Hello, I have been having some frustrations getting MPLAB X IPE working as expected to flash .hex files to my MCU. I have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found