Community
cancel
Showing results for 
Search instead for 
Did you mean: 
SMath12
Innovator
1,210 Views

ds18b20 - Undefined Symbol error on Node.js for Intel Edison

Jump to solution

Hi,

DS18b20 sensor was working on UART using the upm library( https://github.com/intel-iot-devkit/upm GitHub - intel-iot-devkit/upm: UPM is a high level repository that provides software drivers for a wide variety of commo… ).

But currently it throws an error at the require line.

 

var ds= require('jsupm_ds18b20')

I've attached screenshot of the error. Any help is appreciated.

Thanks,

Sanju Mathew

Tags (1)
1 Solution
BBenj
Innovator
131 Views

Solved this. Turns out the issue wasn't with the Edison at all.

TL;DR - The issue was that the Intel XDK was uploading all the old libraries to the Edison each time. We just had to delete all old libraries from the "node_modules" on the XDK working directory on the local system, deleted everything from the ".node_app_slot" directory, and did a fresh upload of the code to the board from the XDK itself. Worked like a charm!

Some more details, for the sake of clarity:

In an earlier version of firmware/mraa/upm (I believe they were mraa v1.0 and upm v0.7 or so), we had to manually install the corresponding libraries (say, jsupm_ds18b20) for the code to work. So we added it to the dependencies in "package.json". (I may have been wrong about that, I don't know. But it worked!) Once we updated the Edison to the latest firmware and mraa to 1.5.1 and upm to 1.0.1, we noticed that we no longer needed to do that. So, we removed the libraries from the dependencies, assuming that that would stop the XDK from downloading and transferring the libraries to the board. It didn't. I saw that the XDK kept uploading the libraries, but I assumed that they must be the latest ones, so it wouldn't matter. The tell was that running the same "var ds18b20 = require('jsupm_ds18b20')" line from within the node shell from a different directory on the intel Edison worked fine. It only caused errors when it was run within the ".node_app_slot" directory, which had the old library installed in its "node_modules" sub-directory... So, cleared up the local "node_modules" in the XDK working directory, and did a clean upload of the code, and it worked fine.

Thanks for the help!

-Benjamin

View solution in original post

6 Replies
idata
Community Manager
131 Views

Hi Sanju,

 

 

Thank you for contacting us.

 

 

You mention that the sensor was previously working, but currently throws an error. Could you share some details on what you did that might have caused the sensor to stop working? If you had to install some libraries in the Edison to make the sensor work and then you flash the board, for example, the previous configuration will not be saved and you'd have to configure the libraries again.

 

 

First, make sure the sensor is properly connected and powered, you can check /message/435531# 435531 https://communities.intel.com/message/435531# 435531 for more information.

 

Also, I found a guide and a community thread that discusses powering the sensor, code, libraries, schematics and more. Take a look at /thread/80636 https://communities.intel.com/thread/80636 and http://www.i-programmer.info/programming/hardware/9216-exploring-edison-the-ds18b20-1-wire-temperatu... http://www.i-programmer.info/programming/hardware/9216-exploring-edison-the-ds18b20-1-wire-temperatu... and make sure you're not missing any steps and all configuration is properly set.

 

 

I'll be waiting for your response.

 

 

-Sergio

 

SMath12
Innovator
131 Views

Sorry for the delay in response.

Yeah, I've been through all those links and the issue is still there. The sensor was working perfectly fine and then we had to reflash the Edison with a new firmware and now it comes up with the error Ive mentioned before.

Just for testing purposes, we opened a terminal, navigated to node app slot folder, executed node, this opened up the node shell and typed in the library require portion that was throwing an error. It still showed the same error. We also executed npm list and it listed all packages installed.

Now we got out of the folder, executed node, at the prompt npm list showed nothing and then when the library include was executed it worked fine. No errors.

We are currently using mraa upm version 1.5. The one that worked was mraa upm v1.0.

I might be missing something very basic and sorry for being so naïve on this. I just cant figure out what's happening.

Thanks for your help.

- Sanju

idata
Community Manager
131 Views

Hi,

 

 

Thank you for letting us know you already tried the links we mentioned. From what you're saying this may be related to a compatibility issue caused by one of the libraries needed. You mention you flashed a new firmware. Specifically, what image are you using now, and what image was the one previously working? To confirm you're using the latest image, type cat /etc/release and you should see 201606061707 as an output.

 

 

Now it's also recommended you use the latest mraa and upm versions.

 

Use the following commands to update UPM and MRAA:

 

echo "src mraa-upm http://iotdk.intel.com/repos/3.5/intelgalactic/opkg/i586" > /etc/opkg/mraa-upm.conf opkg update opkg install mraa opkg install upm

 

 

At the end you should have:

 

UPM library: 1.0.0

 

MRAA library 1.5.1

 

You can check with

 

opkg list-installed|grep mraa and opkg list-installed|grep upm

 

 

Let us know if this resolves your issue.

 

 

-Sergio

 

idata
Community Manager
131 Views

Hi Sanju,

 

 

Do you still need assistance with this case? Did you try our previous suggestion?

 

 

-Sergio

 

BBenj
Innovator
132 Views

Solved this. Turns out the issue wasn't with the Edison at all.

TL;DR - The issue was that the Intel XDK was uploading all the old libraries to the Edison each time. We just had to delete all old libraries from the "node_modules" on the XDK working directory on the local system, deleted everything from the ".node_app_slot" directory, and did a fresh upload of the code to the board from the XDK itself. Worked like a charm!

Some more details, for the sake of clarity:

In an earlier version of firmware/mraa/upm (I believe they were mraa v1.0 and upm v0.7 or so), we had to manually install the corresponding libraries (say, jsupm_ds18b20) for the code to work. So we added it to the dependencies in "package.json". (I may have been wrong about that, I don't know. But it worked!) Once we updated the Edison to the latest firmware and mraa to 1.5.1 and upm to 1.0.1, we noticed that we no longer needed to do that. So, we removed the libraries from the dependencies, assuming that that would stop the XDK from downloading and transferring the libraries to the board. It didn't. I saw that the XDK kept uploading the libraries, but I assumed that they must be the latest ones, so it wouldn't matter. The tell was that running the same "var ds18b20 = require('jsupm_ds18b20')" line from within the node shell from a different directory on the intel Edison worked fine. It only caused errors when it was run within the ".node_app_slot" directory, which had the old library installed in its "node_modules" sub-directory... So, cleared up the local "node_modules" in the XDK working directory, and did a clean upload of the code, and it worked fine.

Thanks for the help!

-Benjamin

View solution in original post

idata
Community Manager
131 Views

Hi Benjamin,

 

 

Thank you for sharing! Hopefully this workaround will be helpful to other community users.

 

Have a nice day.

 

 

-Sergio

 

Reply