Still not working
goophox opened this issue · 7 comments
Hello Rick.
I bothered you in Kickstarter lately. Sorry.
May be I have the same issue as in one of the closed ones.
I got the ZeroPi hooked up on a PI3 and I have connected one stepper to port 1 and one at port 4. Additional there is a DC-motor connected to A of port 2. May be I can take one of my PI2s to check.
I took Jessie as of march 18, 2016 and installed nodejs v6.0.0 as mentioned at
http://thisdavej.com/beginners-guide-to-installing-node-js-on-a-raspberry-pi/
I continued with your guide including the latest firmware stuff on the ZeroPi.
But then I got errors at:
pi@zeropi3:~ $ sudo apt-get install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi (>= 0.3.0-2) but it is not going to be installed
Depends: node-ansi-color-table but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
Depends: node-inherits but it is not going to be installed
Depends: node-ini (>= 1.1.0) but it is not going to be installed
Depends: node-lockfile but it is not going to be installed
Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
Depends: node-gyp (>= 0.10.9) but it is not going to be installed
Depends: node-nopt (>= 3.0.1) but it is not going to be installed
Depends: node-npmlog but it is not going to be installed
Depends: node-once but it is not going to be installed
Depends: node-osenv but it is not going to be installed
Depends: node-read but it is not going to be installed
Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
Depends: node-request (>= 2.25.0) but it is not going to be installed
Depends: node-retry but it is not going to be installed
Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
Depends: node-semver (>= 2.1.0) but it is not going to be installed
Depends: node-sha but it is not going to be installed
Depends: node-slide but it is not going to be installed
Depends: node-tar (>= 0.1.18) but it is not going to be installed
Depends: node-underscore but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I ignored that. The next steps were ok, but affter creation and start of MyApp (myapp) no motor moves.
I am not familiar with node, so I packed the Basic Usage instructions into the file index.js and ran it per node index.js. I got some huge stack traces. Find below the first lines.
It would be nice, if you could help me or just push me onto the right track. May be I will get one of these MegaPIs, but I am not optimistic that they run out of the box. In the meantime, I will try and free one of my PI2s or PI1s.
Kind regards. Oliver
pi@zeropi3:~/Desktop/MyApp $ node index.js
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.
==== JS stack trace =========================================
Security context: 0x320790f1 #0#
1: .node [module.js:568] [pc=0x74b7a5e4](this=0x40809371 <an Object with map 0x32f0bbcd>#1#,module=0x40808a01 <a Module with map 0x32f0beb9>#2#,filename=0x40808a29 <String[76]: /home/pi/Desktop/MyApp/node_modules/serialport/build/Release/serialport.node)
2: load [module.js:456] [pc=0x74b41a38](this=0x40808a01 <a Module with map 0x32f0beb9>#2#,filename=0x40808a29 <String[76]: /home/pi/Desktop/MyApp/node_modules/serialport/build/Release/serialport.node)
3: tryModuleLoad(aka tryModuleLoad) [module.js:415] [pc=0x74b41528](this=0x320080c9 ,module=0x40808a01 <a Module with map 0x32f0beb9>#2#,filename=0x40808a29 <String[76]: /home/pi/Desktop/MyApp/node_modules/serialport/build/Release/serialport.node)
...
45: _load [module.js:407] [pc=0x74b3c574](this=0x408089dd <JS Function Module %28SharedFunctionInfo 0x31d190e1%29>#3#,request=0x408120d5 <String[31]: /home/pi/Desktop/MyApp/index.js>,parent=0x32008081 ,isMain=0x32008129 <true)
46: runMain [module.js:575] [pc=0x74b3bfd8](this=0x408089dd <JS Function Module %28SharedFunctionInfo 0x31d190e1%29>#3#)
47: startup(aka startup) [node.js:159] [pc=0x3d142c50](this=0x320080c9 <undefined)
48: /* anonymous /(aka / anonymous */) [node.js:444] [pc=0x3d1403c8](this=0x32008081 ,process=0x32088b89 <a process with map 0x28c0e825>#24#)
==== C stack trace ===============================
(empty)
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.
==== JS stack trace =========================================
Security context: 0x320790f1 #0#
1: .node [module.js:568] [pc=0x74b7a5e4](this=0x40809371 <an Object with map 0x32f0bbcd>#1#,module=0x40808a01 <a Module with map 0x32f0beb9>#2#,filename=0x40808a29 <String[76]: /home/pi/Desktop/MyApp/node_modules/serialport/build/Release/serialport.node)
2: load [module.js:456] [pc=0x74b41a38](this=0x40808a01 <a Module with map 0x32f0beb9>#2#,filename=0x40808a29 <String[76]: /home/pi/Desktop/MyApp/node_modules/serialport/build/Release/serialport.node)
3: tryModuleLoad(aka tryModuleLoad) [module.js:415] [pc=0x74b41528](this=0x320080c9 ,module=0x40808a01 <a Module with map 0x32f0beb9>#2#,filename=0x40808a29 <String[76]: /home/pi/Desktop/MyApp/node_modules/serialport/build/Release/serialport.node)
...
44: tryModuleLoad(aka tryModuleLoad) [module.js:415] [pc=0x74b41528](this=0x320080c9 ,module=0x40811d8d <a Module with map 0x32f0beb9>#21#,filename=0x40811e4d <String[31]: /home/pi/Desktop/MyApp/index.js)
45: _load [module.js:407] [pc=0x74b3c574](this=0x408089dd <JS Function Module %28SharedFunctionInfo 0x31d190e1%29>#3#,request=0x408120d5 <String[31]: /home/pi/Desktop/MyApp/index.js>,parent=0x32008081 ,isMain=0x32008129 <true)
46: runMain [module.js:575] [pc=0x74b3bfd8](this=0x408089dd <JS Function Module %28SharedFunctionInfo 0x31d190e1%29>#3#)
47: startup(aka startup) [node.js:159] [pc=0x3d142c50](this=0x320080c9 <undefined)
48: /* anonymous /(aka / anonymous */) [node.js:444] [pc=0x3d1403c8](this=0x32008081 ,process=0x32088b89 <a process with map 0x28c0e825>#24#)
==== C stack trace ===============================
(empty)
node is standing here without terminating and without any motor movement.
I found a PI2 and came to the same result.
Hi Oliver,
I have made an update to the module that bumps to the latest version of serialport. This will stop all of those deprecation warnings from showing up again. It seems that serialport 2.x was creating objects with non primitives and node won't be supporting that soon, so i'm glad you noticed it!
running npm update
should update it, but if you want to clean it completely remove the 'node_modules' folder, update the version of zeropi in the package.json
to 0.0.5
and npm install that will rebuild your dependencies from scratch (I do this on mine when it's a tiny app, but i'm a bit of a weirdo).
Could you turn on debugging on the module to (hopefully) see if you are getting a successful open connection to the serial port on your Pi. Just set { debug: true }
when instantiating:
const zeropi = new ZeroPi({ debug: true });
When you run node index
it should spit out 'Serial port opened successfully'. Turning debug on will also display any errors that occur with the serial port. Just paste what you get in here and we should be able to see what the issue is.
Regarding the hanging at the end of the script. Node will stay in the script until you purposely exit it. So when you have finished you can call process.exit()
:
// From the examples
const ZeroPi = require('zeropi');
const zeropi = new ZeroPi();
zeropi.onOpen(() => {
zeropi.stepperMove(0, 1000, 1000, () => {
// The move is complete, I want to exit the script
process.exit();
});
});
I'll keep an eye on this today (it's currently 9:15 am here) in the hopes that I can help you without another 16 hour delay ;)
Hello.
I removed the node_modules folder in MyApp, updated the package.json to 0.0.5 and ran the npm update. Then I modified the index.js to contain the sample of your answer including the debug and this is what happens:
pi@zeropi3:~/Desktop/MyApp $ node index.js
Serial port opened successfully
No motor is running and the script does not come back even with this process.exit() statement.
I rechecked my configuration to see, that Serial, SPI and 1-Wire are disabled and SSH, I2C and Camera are enabled. Is this OK?
I also tried the sample code to light the blue LED, but nothing happened.
Before going to the PI I definitely uploaded the latest firmware.ino (...) to the ZeroPi via Native USB.
Delays are not a problem for me. In the picture you can see some other projects that are fightng me. ;-)
Kind regards. Oliver
if the serial port has been opened successfully then we are 90% there. Can you paste your script?
Sorry went full derp there, you used my code exactly above. Another thing you could check is that the user you are calling node with (probably pi) is in the 'dialout' group. Mine was set up by default, so I'm assuming yours is too, but it's worth a check.
In raspi-config you should have serial disabled. If it's on it won't allow anything to use the serial port.
Hello Rick.
I may have found my problem. I removed the ZeroPi from the RaspberryPi, connected it back to my PC (by debugger and directly native USB) and sent some sample code driving the two steppers and the DCmotor. Nothing happens.
I think, my ZeroPi or the drivers are dead.
Thank you for helping me. I will store the ZeroPi in my dead crowdfunding shelf and hope, that they will send me the MegaPi.
By the way, the user pi I am using is in the dialout group and in raspi-config Serial is disabled. ;-)
In the meantime I can connect my Servo/PWM Pi Hat to drive something less innovative.
Have a nice time.
Oliver
Oh dear, sorry to hear that... I must have got lucky! I think they should send you a MegaPi to replace the broken ZeroPi ;)