noopkat / avrgirl-arduino Goto Github PK
View Code? Open in Web Editor NEW:girl: :pager: A NodeJS library for flashing compiled sketch files to Arduino microcontroller boards.
License: MIT License
:girl: :pager: A NodeJS library for flashing compiled sketch files to Arduino microcontroller boards.
License: MIT License
This is as easy as either adding a new board type or adding 0x6001
as a productId for 'mega'.
Settings are the same for this board as the mega.
This is a serialport issue serialport/node-serialport#552
If you specify the port, avrgirl-arduino will work just fine. This bug will be resolved once node-serialport is fixed. Sorry for the inconvenience π
Very nice package.
I want to integrate it into my home automation platform ioBroker and found small problem.
It would be nice to have better integration possibilities. One of that is debug not to the console, but somewhere else.
this.debug = options.debug ? (typeof options.debug === 'function') ? options.debug : console.log.bind(console)) : function() {};
Flashing still effectively worked.
Replicated on an Arduino Micro with the returned error Flashed content length differs! local:128vs device: 1
I used blew command to flash a demo, but error comes
$ avrgirl-arduino flash -f Blink.ino.eightanaloginputs.hex -a nano
/Users/xxx/.nvm/versions/node/v6.10.2/lib/node_modules/avrgirl-arduino/bin/cli.js:40
} else if (!boards.byName[argz.a]) {
^
TypeError: Cannot read property 'nano' of undefined
at handleInput (/Users/xxx/.nvm/versions/node/v6.10.2/lib/node_modules/avrgirl-arduino/bin/cli.js:40:32)
at Object. (/Users/xxx/.nvm/versions/node/v6.10.2/lib/node_modules/avrgirl-arduino/bin/cli.js:109:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)
Currently if you pass in a board object with only the name of the board in it, it breaks. Normally we'd want it to either error if missing vital props, or if the board object only contains the name, just merge it in with a default board object for the chosen board.
Hi π, i send a pull request to noopkat/js-stk500v1#1 , because we have a problem with the console.log and verifyPage function. I think that maybe you don't see the pull requests on that repo. It's a small change to avoid problems when we use avrgirl-arduino inside a chrome extension.
Thanks ! π
Is this compatibility planned, and how difficult would it be to implement?
Pinoccio Scouts use the stk500v2 protocol, which is supplied in avrgirl-arduino already. An addition to boards.js
should be all that is required, with some testing with a real device. I no longer have a Scout to test with. Adding a precompiled version of both Standard Firmata and Blink sketches would also very much be appreciated.
I'm trying to flash a (working and tested) hex file to a Pololu Zumo 32U4.
The first time it get stuck on:
found zumo on port /dev/cu.usbmodem1411
reset complete.
connected
When I reload the page (that forces the back end to try again) I get:
found zumo on port /dev/cu.usbmodem1411
reset complete.
Error: could not open board on /dev/cu.usbmodem1411
at /Users/krille/Dropbox/Dev/robotkodarn/node_modules/avrgirl-arduino/lib/connection.js:152:15
at next (/Users/krille/Dropbox/Dev/robotkodarn/node_modules/awty/index.js:39:11)
at SerialPort.<anonymous> (/Users/krille/Dropbox/Dev/robotkodarn/node_modules/avrgirl-arduino/lib/connection.js:143:7)
at SerialPort._error (/Users/krille/Dropbox/Dev/robotkodarn/node_modules/serialport/lib/serialport.js:148:14)
at SerialPort.<anonymous> (/Users/krille/Dropbox/Dev/robotkodarn/node_modules/serialport/lib/serialport.js:172:19)
Note that I'm running the manualReset
to true
.
And by the way, the reason it says zumo
is because I've made a custom board:
var board = {
name: 'zumo',
baud: 57600,
signature: new Buffer([0x1e, 0x95, 0x87]),
productId: ['0x0036', '0x8036', '0x800c', '0x8036'],
protocol: 'avr109'
}
var avrgirl = new Avrgirl({
board: board,
debug: true,
manualReset: true
});
I've also tried using the leonardo
that should be very alike and may also work (it works using the native Arduino app when compiling and uploading) but with no success.
Any ideas?
Please see avrgirl-stk500v2 tests and the travis file for a good starting point on this. Serialport will need to be stubbed, an example is in the repo linked.
One instance replicated as per Test Pilot report:
Concerns:
First of all. Big thanks for this great work!
I have build an Plugin for Pimatic https://github.com/Icesory/pimatic-arduino-updater. When we run a flash process on an RPi often an Time out error occurs. This is testet with Nano328(CH340), Nano328(FT232RL), ProMini 5V328(FT232RL).
Most times this error occurs:
connected
reset complete.
flashing, please wait...
flash complete(red)
{ cause: [Error: Sending 3020: receiveData timeout after 400ms], isOperational: true}
Or this
connected
reset complete.
flashing, please wait...
flash complete(red)
{ cause: [Error: Sending 55001620: receiveData timeout after 400ms], isOperational: true}
This is an complete log from Pimatic with an other failure
22:31:55.805 [pimatic-arduino-updater] Start Arduino flash for homeduino
connected
reset complete.
flashing, please wait...
22:32:02.960 [pimatic] A uncaught exception occured: TypeError: Cannot call method 'toString' of undefined
22:32:02.960 [pimatic]> at /home/pi/pimatic-app/node_modules/pimatic-arduino-updater/node_modules/avrgirl-arduino/node_modules/stk500/index.js:311:44
22:32:02.960 [pimatic]> at /home/pi/pimatic-app/node_modules/pimatic-arduino-updater/node_modules/avrgirl-arduino/node_modules/stk500/lib/sendCommand.js:37:16
22:32:02.960 [pimatic]> at finished (/home/pi/pimatic-app/node_modules/pimatic-arduino-updater/node_modules/avrgirl-arduino/node_modules/stk500/lib/receiveData.js:38:5)
22:32:02.960 [pimatic]> at null._onTimeout (/home/pi/pimatic-app/node_modules/pimatic-arduino-updater/node_modules/avrgirl-arduino/node_modules/stk500/lib/receiveData.js:43:7)
22:32:02.960 [pimatic]> at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
22:36:24.314 [pimatic]> This is most probably a bug in pimatic or in a module, please report it!
22:36:24.360 [pimatic] shutting pimatic down...
The used node version is v0.10.24. On my dev machine (Ubuntu 14.04LTS) all works right. But on the RPi almost every flash throws an error. But in most times the Arduino is flashed with the given hexfile.
Any suggestions to isolate the failure?
We're rolling our own hardware which has specs similar to the leonardo, so when flashing with the Arduino IDE we'll select that option. However we have a different productId to what's expected by the library, as specified in boards.js. Obviously with this set 'incorrectly' we'll hit Error: could not reconnect after resetting board.
since the productId doesn't match what's expected.
It'd be great if we could pass an object when creating the Avrgirl instance that specifies the board properties (to pass our modified productId), or alternatively have the search process just check that it can connect to the comName specified in the 'port' property of the options object.
Or if the problem is that boards 'jump' comName's, given that we're selecting one we can search for it later with the productId, etc that it presented to us upon first list?
Newly patched version has not been published to npm as of yet.
Currently any updates to js-stk500v1 will be implicit updates in this project. This has the potential to break things, without any semver versioning to assist with rollbacks. Let's fix this, by either getting the github deps back to mainline, or pointing at specific SHAs instead of just branch names.
Note: This issue is ideal for folks wishing to make their first code contribution/pull request to AVRGirl Arduino, or it might even be their first open source pull request ever! Please do not open a PR for this if you're an existing code/docs contributor to AVRGirl Arduino. Thanks β€οΈ
The Issue:
Plugging in an Arduino isn't an out-of-the-box-working experience for Windows users. Installing the Arduino IDE and the included drivers is an important first step before being able to use AVRGirl Arduino.
In the installation instructions, I'd love to see a small section in this project's README.md file added for Windows, with extra details documented on how to get the above 2 steps up and running.
There is already some great docs on how users can do this on this Arduino website page. It would be sufficient enough to share this link in the AVRGirl Arduino README, with some friendly language advising following only steps 1-4 is necessary. Keeping to the current writing personality/style of the README is encouraged.
Please follow the code contribution guidelines as set out in this repo's contributing guide.
Thank you @byronhulcher for reporting this via Test Pilot! β¨
Somewhat an out-of-scope issue here, so I apologize if this is the wrong place for this, but I extended avrgirl-arduino
to be able to send a message and wait for data back over serial, and it works beautifully. I hijack the automatic port finder and board validation to have a serialport instance ready to go before I send a message. Currently, I flashed one of our testing Arduino boards with an echo-echo Sketch, where it just spits back the data it reads over serial.
That said, I see an odd behaviour: I use a serialPort.on('data',
function to wait for communications from the Arduino, but I have to wait approximately 750ms (minimum) after opening a connection before I can send a String over serial, and I can't do anything immediately after or the data coming back will be garbled.
Is this something you've noticed at all? Happy to provide code if you're interested in what I'm having it do, and I know it's outside of scope, just wondering if this is any behaviour you've seen before.
Thanks!
This was fixed in v1.5.3 release, but documenting in case this needs reopening later.
See http://community.arduboy.com/t/rom-installer-for-windows-mac-and-linux/233/3
Seems to happen on Window and Linux machines, but not consistently.
Arduboy is a tiny gameboy-like device, based around the Arduino Leonardo. My dev kit has just arrived. It runs and flashes fine with the Arduino IDE, but with avrgirl-arduino
I just couldn't get it to flash the generated hex
.
It usually doesn't work, simply fails to access the device:
MacBooks-MacBook-Air:avrgirl-arduino flaki$ node bin/cli.js flash -f ~/Data/ArduBreakout/examples/ArduBreakout/ArduBreakout.cpp.leonardo.hex -a leonardo -v
found leonardo on port /dev/cu.usbmodem1411
resetting board...
Failed to connect: # 1
reset complete.
[Error: Cannot open /dev/cu.usbmodem1411]
MacBooks-MacBook-Air:avrgirl-arduino flaki$
(fwiw, the board does reset on every run of the above command, consistently).
Sometimes it then seems to work, but amidst flashing an error is thrown, and the device flash is left in a garbled state (that is, flashing overwrote some of the installed data, so the device wouldn't "start"). Reflashing with a separate tool (like Arduino IDE) "fixed" the state of the flash, so at least it doesn't brick the device or anything like that:
MacBooks-MacBook-Air:avrgirl-arduino flaki$ node bin/cli.js flash -f ~/Data/ArduBreakout/examples/ArduBreakout/ArduBreakout.cpp.leonardo.hex -a leonardo -v
found leonardo on port /dev/cu.usbmodem1411
resetting board...
Failed to connect: # 1
Failed to connect: # 2
reset complete.
connected
flashing, please wait...
/Users/flaki/Data/avrgirl-arduino/node_modules/chip.avr.avr109/chip.avr.avr109.js:156
throw err;
^
Error: TODO: Start Linear Address Record
at /Users/flaki/Data/avrgirl-arduino/node_modules/chip.avr.avr109/node_modules/intelhex/index.js:57:28
at Array.forEach (native)
at /Users/flaki/Data/avrgirl-arduino/node_modules/chip.avr.avr109/node_modules/intelhex/index.js:11:11
at process._tickCallback (node.js:355:11)
MacBooks-MacBook-Air:avrgirl-arduino flaki$
Since Arduino 1.6.5, there is a simpler method for exporting your hex file.
sketch > export binary
It it saved inside the sketch folder.
No longer have to search for random generated folder.
Hello,
I have been working with Avrgirl and the Arduino Uno without much issues, but when I try with an Arduino Nano, reading from the serial port fails.
I realise this might be somewhat outside of what Avrgirl is meant to be used for.
Basically, I am implementing a Serial Monitor, where I am able to choose which Serial Port to open. This works well for the Uno, but the Nano responds with a nasty "Port is open" exception. After that, however, the Serial communication is read, and everything seems to be working OK.
I've tried to debug, but I am not sure why this is happening on the Nano, and not the Uno.
This is the code I have for opening the serial port (I have tried openImmediately set to true as well):
`if (port) {
var serialPort = new SerialPort(port, {
baudrate: 9600,
openImmediately: false
}); // this is the openImmediately flag [default is true]
selectedSerialPort = serialPort;
serialPort.open(function (error) {
if (error) {
console.log('failed to open: ' + error);
} else {
console.log('open');
serialPort.on('data', function (data) {
//console.log('data received: ' + data);
serialDataCache = serialDataCache.concat(data);
});
}
});
}`
After installing with npm install avrgirl-arduino --save
and requiring it, I get the following error in my electron project:
bindings.js:83 Uncaught Error: Module version mismatch. Expected 50, got 51.
Any suggestions?
System: macOS
npm v4.1.1
node v7.4.0
Hi!
I'm working with a device (a Shortcut keyboard) that - at the moment at least - requires me to press a physical reset button on it, before I can flash a firmware. With avrdude
, this causes no issues, but avrgirl
wants to reset the device herself, and things fail horribly when I press the reset button while avrgirl is trying to reset it too.
Would it be possible to have a flag for the flash
method to skip resetting the device, and just assume it is in a programmable state?
Work on this has started.
- poll for connect
- wait for close before reset callback
magic number delays π π½
Just noticed this in the readme:
avrgirl-arduino list
vs.
Avrgirl.listPorts(function(err, ports) {
...
});
I would happily submit a patch that aliases Avrgirl.list
=> Avrgirl.listPorts
, if such a feature was desired. (Also can do on the other avrgirl-*
modules)
Product link: https://www.sparkfun.com/products/12640 (there's also a 3V, 8MHz option)
I'm not sure why, but I bought this board a while ago on impulse when ordering other things. It's an interesting one. ATmega32U4 on board, so it's a Leonardo/avr109. But it seems to follow the Arduino Pro advantage of up to 16MHz and 12v. $20USD, not bad but twice the price of a Pro Mini.
Use serial port open attempts rather than arbitrary delay.
This should be done post refactor.
Flashing a basic hex file onto an arduino pro micro fails with "Error: could not reconnect after resetting board."
debug shows it finding the micro, and on the correct port.
debug then shows it resetting the board, and my pro micro does in fact reboot
then.... error, help!
As mentioned in the stream, what do you think of using semantic-release in this repository?
I thought about doing it the following way:
Hooks could be run optionally by default (opt-in) and therefore be easier for new contributors to actually contribute.
Let me know your thoughts :)
The project description confuses me.
An avrgirl-wrapper library for flashing Arduino microcontroller boards with NodeJS.
To me this sounds like a library that somehow puts NodeJS on Arduino boards, which leaves me at first amazed, then severely disappointed.
A clearer description could be:
An avrgirl-wrapper NodeJS library for flashing Arduino microcontroller boards.
π¨ You need to enable Continuous Integration on all branches of this repository. π¨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.
Since we did not receive a CI status on the greenkeeper/initial
branch, we assume that you still need to configure it.
If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you donβt want it to run on every branch, you can whitelist branches starting with greenkeeper/
.
We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
I'm almost done with this.
Seems like spotty support in general for NodeJS 5.x, but some solid time needs to go into stabilizing and establishing where the issues are for each operating system, etc.
NodeJS 5.x is not necessarily 'supported' at this stage, but this might be worth looking into.
notes: "after installing@latest with errors like... avrgirl-arduino flash -f /tmp/arduino_builds/BuiltInExcitment.ino.hex -a uno -p /dev/cu.usbmodem5D11 -v\nconnected\nreset complete.\nflashing, please wait...\nflash complete.\n[Error: Sending 6400804688e990e09f938f9382e093e09f938f930e94d30681e08a830f900f900f900f900f900f90df91cf910895cf93df93ec018f819885019721f4ce010e94680403c0ce010e9411048f819885df91cf9108950f931f93cf93df93ec018b014a960e94f003ce0140960e94f003ce010e94680481e08e878d871c861b86c80163e370e020: receiveData timeout after 400ms]\nmake: *** [avrdude] Error 1\n"
error: "no Arduino 'uno' found."
nodev: "5.2.0"
os: "darwin"
osv: "15.4.0" (El Capitan)
board: "uno"
We just need a list of the board names as an array of strings. A boards.map
might be all that is required, and to have it as a static method on AvrgirlArduino
.
This is a priority issue, in order to support @ajfisher's great work on his nodebots-interchange project.
A few things to consider here:
pro-mini
as the string based identifier.I used the command sudo npm install avrgirl-arduino
but when I try running the command avrgirl-arduino list
I get an error saying -bash: avrgirl-arduino: command not found
I ran npm init
before running the first command and it still doesn't work.
avrgirl-arduino list
- lists current serial ports availableavrgirl-arduino boards
- lists currently supported boardsThis fits into #5. I do not own any sets from Little Bits. I added support a while ago but cannot test it at the moment.
If anyone has this module, could they please compile some form of 'hello world' script for it (such as a blink sketch) and run the following code to see if it works as expected?
var Avrgirl = require('avrgirl-arduino');
var avrgirl = new Avrgirl({
board: 'little-bits',
debug: true
});
avrgirl.flash('Blink.cpp.hex', function (error) {
if (error) {
console.error(error);
} else {
console.info('done.');
}
});
Thanks a million π
My budget can't always support having every single Arduino on hand to test this with. I would love if anyone has matching hardware supported by avrgirl-arduino to verify that everything works well. I just recently busted my Arduino Mega's FTDI connection somehow, so this sort of thing becomes a problem for me to keep up with.
I mostly test with OSX (which is my dev machine). I have both Windows and Linux VM's that I use to test those platforms with, however these sometimes don't replicate a "real" machine experience. An example of this is due to using a modern.ie image for Windows, I can't get a realistic take on the automatic device driver installation workflow that Windows normally does. So! I would love if those with any platform could just give this library a go with any Arduino they have sitting around that is supported π
Successfully uploading a Blink.cpp.hex file is a great test to try. Included in this repo is a copy of a compiled and ready-to-flash Blink file for each supported device.
If you encounter any issues, please open a new issue on this repo describing what happened (errors, screenshots etc), or comment on an existing issue with a π if you spot a duplicate.
Thank you so much in advance π
I used the command sudo npm install avrgirl-arduino
but when I try running the command avrgirl-arduino list
I get an error saying -bash: avrgirl-arduino: command not found
I ran npm init
before running the first command and it still doesn't work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.