profile
viewpoint

fivdi/onoff 990

GPIO access and interrupt detection with Node.js

fivdi/pigpio 684

Fast GPIO, PWM, servo control, state change notification and interrupt handling with Node.js on the Raspberry Pi

fivdi/i2c-bus 240

I2C serial bus access with Node.js

fivdi/epoll 72

A low-level Node.js binding for the Linux epoll API

fivdi/mcp-spi-adc 52

MCP3002/4/8, MCP3202/4/8 and MCP3304 SPI analog to digital conversion with Node.js

fivdi/lcd 51

Node.js Hitachi HD44780 LCD driver

fivdi/gpio-button 18

Hardware momentary push-buttons the Linux way

fivdi/linux-io 14

Extensible Linux IO Plugin for Johnny-Five

fivdi/pi-io 14

Raspberry Pi IO Plugin for Johnny-Five

fivdi/avr-io 9

Control an ATmega328P via I2C

issue commentfivdi/epoll

epoll 64bit support for Raspberry Pi 4B error epoll.node: wrong ELF class: ELFCLASS64

Does epoll not support 64 bit system architecture?

Yes, it does.

bmwertman

comment created time in 3 hours

issue commentfivdi/epoll

Add node-gyp to package dependencies

That's good news. Thank you for providing the feedback.

dawn-minion

comment created time in 3 hours

issue commentfivdi/pigpio

Proximity Sensor Bad Readings

Here's a link to an issue I opened a few years ago but had forgotten about that may provide some additional information https://github.com/joan2937/pigpio/issues/52. It's a fairly long issue. It's a fairly long issue. This comment is interesting https://github.com/joan2937/pigpio/issues/52#issuecomment-195288773.

evandavey

comment created time in 3 hours

PR closed fivdi/epoll

#40 Add node-gyp to package dependencies

PR adds node-gyp to the package dependencies, which makes this package installable via Yarn PnP, and removes the requirement that node-gyp be installed already.

Fixes #40

+2 -1

1 comment

1 changed file

dawn-minion

pr closed time in 3 hours

pull request commentfivdi/epoll

#40 Add node-gyp to package dependencies

Closing as it no longer appears to be needed. See https://github.com/fivdi/epoll/issues/40#issuecomment-698753278.

dawn-minion

comment created time in 3 hours

issue commentfivdi/pigpio

Proximity Sensor Bad Readings

Do you know if a kernel module like https://github.com/torvalds/linux/blob/master/drivers/iio/proximity/srf04.c would be more reliable?

I haven't used that module so I don't know.

evandavey

comment created time in 4 hours

issue commentfivdi/pigpio

Proximity Sensor Bad Readings

Not necessarily. I'm not familiar with the internal implementation details of the pigpio C library. However, if I'm not mistaken it uses DMA (Direct Memory Access) to monitor inputs. I would assume that the scp command will also result in DMA being used. This could result in bus contention if both processes are competing for resources. This may in turn result in less distance being measured rather than more. I'm only guessing here, that's why it would be better to open an issue over at the pigpio C library repository as the people over there will know more about the subject that I do.

evandavey

comment created time in 4 hours

issue commentfivdi/pigpio

Proximity Sensor Bad Readings

Any idea what might be going on?

I'm guessing here but perhaps the scp command is blocking the single CPU on the Pi Zero W for longer periods of time and preventing the pigpio C library from doing what it needs to do in a timely way.

I'd suggest opening an issue over at the pigpio C library repository and asking if they can provide more information.

evandavey

comment created time in 6 hours

issue commentfivdi/epoll

Add node-gyp to package dependencies

Can we add node-gyp to the package dependencies? Currently it's expected to be installed, but not listed as one of the things this package needs.

This package doesn't really need node-gyp. npm or yarn need it to install this package.

I'm not familiar with Yarn Plug’n’Play but after taking a look at the Getting Started page and giving it a try I haven't encountered any issues and don't understand why node-gyp needs to be added as a dependency.

Here is what I tried:

pi@raspberrypi:~ $ node --version
v14.11.0
pi@raspberrypi:~ $ yarn --version
1.22.5
pi@raspberrypi:~ $ mkdir test
pi@raspberrypi:~ $ cd test/
pi@raspberrypi:~/test $ yarn init
yarn init v1.22.5
question name (test): 
question version (1.0.0): 
question description: 
question entry point (index.js): 
question repository url: 
question author: 
question license (MIT): 
question private: 
success Saved package.json
Done in 2.21s.
pi@raspberrypi:~/test $ yarn add epoll
yarn add v1.22.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 4 new dependencies.
info Direct dependencies
└─ epoll@4.0.0
info All dependencies
├─ bindings@1.5.0
├─ epoll@4.0.0
├─ file-uri-to-path@1.0.0
└─ nan@2.14.1
Done in 5.29s.
pi@raspberrypi:~/test $ yarn --pnp
yarn install v1.22.5
info Plug'n'Play support has been greatly improved on the Yarn v2 development branch.
info Please give it a try and tell us what you think! - https://next.yarnpkg.com/getting-started/install
[1/5] Resolving packages...
[2/5] Fetching packages...
[3/5] Linking dependencies...
[5/5] Building fresh packages...
Done in 6.36s.
pi@raspberrypi:~/test $ 

I also did this:

pi@raspberrypi:~/test $ ls -la
total 60
drwxr-xr-x  4 pi pi  4096 Sep 25 04:30 .
drwxr-xr-x 13 pi pi  4096 Sep 25 04:29 ..
drwxr-xr-x  2 pi pi  4096 Sep 25 04:30 node_modules
-rw-r--r--  1 pi pi   174 Sep 25 04:30 package.json
drwxr-xr-x  3 pi pi  4096 Sep 25 04:30 .pnp
-rwxr-xr-x  1 pi pi 33827 Sep 25 04:30 .pnp.js
-rw-r--r--  1 pi pi  1216 Sep 25 04:30 yarn.lock
pi@raspberrypi:~/test $ rm -rf node_modules/
pi@raspberrypi:~/test $ rm -rf .pnp
pi@raspberrypi:~/test $ rm -rf .pnp.js 
pi@raspberrypi:~/test $ ls -la
total 16
drwxr-xr-x  2 pi pi 4096 Sep 25 04:31 .
drwxr-xr-x 13 pi pi 4096 Sep 25 04:29 ..
-rw-r--r--  1 pi pi  174 Sep 25 04:30 package.json
-rw-r--r--  1 pi pi 1216 Sep 25 04:30 yarn.lock
pi@raspberrypi:~/test $ yarn install
yarn install v1.22.5
info Plug'n'Play support has been greatly improved on the Yarn v2 development branch.
info Please give it a try and tell us what you think! - https://next.yarnpkg.com/getting-started/install
[1/5] Resolving packages...
[2/5] Fetching packages...
[3/5] Linking dependencies...
[5/5] Building fresh packages...
Done in 7.25s.
pi@raspberrypi:~/test $ ls -la
total 56
drwxr-xr-x  3 pi pi  4096 Sep 25 04:31 .
drwxr-xr-x 13 pi pi  4096 Sep 25 04:29 ..
-rw-r--r--  1 pi pi   174 Sep 25 04:30 package.json
drwxr-xr-x  3 pi pi  4096 Sep 25 04:31 .pnp
-rwxr-xr-x  1 pi pi 33827 Sep 25 04:31 .pnp.js
-rw-r--r--  1 pi pi  1216 Sep 25 04:30 yarn.lock
pi@raspberrypi:~/test $ 

It looks like everything works to me. Can you describe how to reproduce the problem please?

dawn-minion

comment created time in 6 hours

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

And remove the USB-Hub for the test.

mikelyndersOKCC

comment created time in 2 days

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

Could the fact that these ports are plugged into a USB Hub have any effect on this?

Try pluging some of them directly into the Pi USB ports to see if it makes a difference.

mikelyndersOKCC

comment created time in 2 days

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

I don't really know why it's not working other than that it's a permission issue. Does the file /etc/udev/rules.d/99-com.rules contain the following:

SUBSYSTEM=="input", GROUP="input", MODE="0660"
SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
SUBSYSTEM=="rpivid-*", GROUP="video", MODE="0660"

KERNEL=="vcsm-cma", GROUP="video", MODE="0660"
SUBSYSTEM=="dma_heap", GROUP="video", MODE="0660"

SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
	chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
	chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
	chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
'"

SUBSYSTEM=="pwm*", PROGRAM="/bin/sh -c '\
	chown -R root:gpio /sys/class/pwm && chmod -R 770 /sys/class/pwm;\
	chown -R root:gpio /sys/devices/platform/soc/*.pwm/pwm/pwmchip* && chmod -R 770 /sys/devices/platform/soc/*.pwm/pwm/pwmchip*\
'"

KERNEL=="ttyAMA0", PROGRAM="/bin/sh -c '\
	ALIASES=/proc/device-tree/aliases; \
	if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
		echo 0;\
	elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
		echo 1; \
	else \
		exit 1; \
	fi\
'", SYMLINK+="serial%c"

KERNEL=="ttyAMA1", PROGRAM="/bin/sh -c '\
	ALIASES=/proc/device-tree/aliases; \
	if [ -e /dev/ttyAMA0 ]; then \
		exit 1; \
	elif cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
		echo 0;\
	elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
		echo 1; \
	else \
		exit 1; \
	fi\
'", SYMLINK+="serial%c"

KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
	ALIASES=/proc/device-tree/aliases; \
	if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
		echo 0; \
	elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
		echo 1; \
	else \
		exit 1; \
	fi \
'", SYMLINK+="serial%c"
mikelyndersOKCC

comment created time in 3 days

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

What does sudo udevadm info -q path -n /dev/ttyUSB0 display?

mikelyndersOKCC

comment created time in 4 days

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

Below is what I see on Raspberry Pi OS (32-bit) Lite August 2020 when one serial cable is connected to a Pi 4 via USB. In other words, I can't reproduce the error.

pi@raspberrypi:~/serialport $ whoami
pi

pi@raspberrypi:~/serialport $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

pi@raspberrypi:~/serialport $ uname -a
Linux raspberrypi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux

pi@raspberrypi:~/serialport $ cat /etc/debian_version 
10.4

pi@raspberrypi:~/serialport $ npm list | grep serialport
/home/pi/serialport
└─┬ serialport@9.0.1
  ├─┬ @serialport/binding-mock@9.0.1
  │ ├─┬ @serialport/binding-abstract@9.0.1
  ├─┬ @serialport/bindings@9.0.1
  │ ├── @serialport/binding-abstract@9.0.1 deduped
  │ ├── @serialport/parser-readline@9.0.1 deduped
  ├── @serialport/parser-byte-length@9.0.1
  ├── @serialport/parser-cctalk@9.0.1
  ├── @serialport/parser-delimiter@9.0.1
  ├─┬ @serialport/parser-readline@9.0.1
  │ └── @serialport/parser-delimiter@9.0.1 deduped
  ├── @serialport/parser-ready@9.0.1
  ├── @serialport/parser-regex@9.0.1
  ├─┬ @serialport/stream@9.0.1
npm ERR! extraneous: readable-stream@3.6.0 /home/pi/serialport/node_modules/bl/node_modules/readable-stream
npm ERR! extraneous: readable-stream@3.6.0 /home/pi/serialport/node_modules/tar-stream/node_modules/readable-stream

pi@raspberrypi:~/serialport $ udevadm info -q path -n /dev/ttyUSB0
/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/ttyUSB0/tty/ttyUSB0

pi@raspberrypi:~/serialport $ node -v
v14.9.0

pi@raspberrypi:~/serialport $ cat t.js 
const SerialPort = require('serialport')

SerialPort.list().then(ports=>console.log(ports), err=>console.log(err))

pi@raspberrypi:~/serialport $ node t.js 
[
  {
    manufacturer: 'FTDI',
    serialNumber: 'XXXXXXXX',
    pnpId: 'usb-FTDI_FT232R_USB_UART_XXXXXXXX-if00-port0',
    locationId: undefined,
    vendorId: '0403',
    productId: '6001',
    path: '/dev/ttyUSB0'
  },
  {
    manufacturer: undefined,
    serialNumber: undefined,
    pnpId: undefined,
    locationId: undefined,
    vendorId: undefined,
    productId: undefined,
    path: '/dev/ttyAMA0'
  }
]

I guess there is something different about your installation but I'm not sure what.

  • Is the new 64-bit versions of Raspberry Pi OS being used?
  • How was the image on the SD card created? Was an old version updated or was Raspberry Pi OS August 2020 freshly flashed onto the SD card?
  • Were permissions modified?
  • Are new udev rules needed for the serial cable being used?
mikelyndersOKCC

comment created time in 4 days

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

Note that to actually use the serialport, the user will also need to be a member of group dialout.

mikelyndersOKCC

comment created time in 6 days

issue closedserialport/node-serialport

SerialPort.list() returns empty when script run without sudo (Raspberry Pi)

Summary of Problem

  • What are you trying to do?

I have developed an Electron Application that displays/graphs/analyzes data from several lab instruments with serial outputs. I have an "autoconnect" feature that use SerialPort.list() to get a list of the ports which I then try to query for serial numbers. This works fine on Windows (which I was using to develop) but now I am trying to deploy my application on several Raspberry Pi's.

  • What happens?

SerialPort.list() returns an empty list [] when run in both Electron and in a minimal test script (see below) on the Raspberry Pi. However, I noticed that running the same script with sudo works as expected. Interestingly, I can connect to the port directly without sudo if I know the port name ahead of time ex: /dev/ttyUSB0

Also, $ udevadm info -q path -n /dev/ttyUSB0 returns nothing but returns as expected with sudo : $ sudo udevadm info -q path -n /dev/ttyUSB0

Any ideas what's going on here? I imagine I shouldn't need sudo to get a list of ports, especially if I can connect to them without it. Also, as a sanity check, I ran a python script with pyserial which lists the ports without sudo on the same Raspberry Pi, so I don't think I have a weird udev/permissions setup.

  • What should have happened?

SerialPort.list() should return a list of ports even when the script is run without sudo

Code to Reproduce the Issue

const SerialPort = require('serialport')

SerialPort.list().then(ports=>console.log(ports), err=>console.log(err))

Versions, Operating System and Hardware

  • SerialPort@9.0.1
  • Node.js v14.11.0
  • Linux (Raspberry Pi 4) Raspberry Pi OS August 2020
  • Hardware and chipset? RPi -> USB/RS-232 Adapters -> Generic Serial Device (Laboratory Instrument)

closed time in 6 days

mikelyndersOKCC

issue commentserialport/node-serialport

SerialPort.list() only shows ports when script is run with sudo (Rasperry Pi)

The code shown above will list the available ports if run by user pi on Raspberry Pi OS. If a different user runs the script, that user will need to be a member of group gpio in order for the code function correctly. If the program is being run by a user that is not a member of group gpio please add the user to group gpio to see if it works.

mikelyndersOKCC

comment created time in 6 days

issue commentstlink-org/stlink

STM32F103C8T6 using St-link v2 doesn't flash on Ubuntu (works properly on windows)

What's very unusual about the information in the first post above is that a flash size of 0 bytes is reported:

2020-09-07T15:38:53 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0 bytes (0 KiB) in pages of 1024 bytes

The flash size should be reported as 65536 bytes (64 KiB).

The device ID reported is 0x0410 which is correct. The revision ID reported is 0x2000 which is valid. The revision ID reported is a little unusual in my opinion as I would expect an STM32F103C8T6 that was manufactured within the last few years to have a revision ID of 0x2003. Nevertheless, 0x2000 is valid.

The STM32F103C8T6 has a 16-bit flash size register at location 0x1ffff7e0. The content of this register should be 0x40 (64) indicating that the device has 64 KiB flash. STLink relies on the value of this register.

I'm not familiar with PlatformIO or how it flashes devices. However, you do mention that you can flash the STM32F103C8T6 with PlatformIO. This means that you could implement a program that examines the content of the flash size register to confirm whether or not it's value is 0x40. If the value is 0x40, we have made no progress. If the value is 0, it would help to explain the issue.

marcosQuesada

comment created time in 12 days

issue commentstlink-org/stlink

STM32F103C8T6 using St-link v2 doesn't flash on Ubuntu (works properly on windows)

For me, everything works as expected with v1.6.1 on Ubuntu 16.04 with a bluepill:

$ st-info --version
v1.6.1

$ st-info --probe
Found 1 stlink programmers
 serial:     500024001800003250334d4e
 hla-serial: "\x50\x00\x24\x00\x18\x00\x00\x32\x50\x33\x4d\x4e"
 flash:      65536 (pagesize: 1024)
 sram:       20480
 chipid:     0x0410
 descr:      F1xx Medium-density

$ st-flash --version
v1.6.1

$ st-flash write blinky.bin 0x8000000
st-flash 1.6.1
2020-09-11T06:39:55 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
file blinky.bin md5 checksum: e378e365fc9787922c1d3514fb7d8d3e, stlink checksum: 0x0000c4a8
2020-09-11T06:39:55 INFO common.c: Attempting to write 688 (0x2b0) bytes to stm32 address: 134217728 (0x8000000)
2020-09-11T06:39:55 INFO common.c: Flash page at addr: 0x08000000 erased
2020-09-11T06:39:55 INFO common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2020-09-11T06:39:55 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2020-09-11T06:39:55 INFO flash_loader.c: Successfully loaded flash loader in sram
  1/1 pages written
2020-09-11T06:39:55 INFO common.c: Starting verification of write complete
2020-09-11T06:39:55 INFO common.c: Flash written and verified! jolly good!
marcosQuesada

comment created time in 14 days

issue commentfivdi/onoff

Pi hangs w/ buster when pin value changes

@jlit Thank you for providing the feedback.

A Raspberry Pi has 53 GPIOs but many of them are not broken out to the 40 pin GPIO header. See here. I don't know if it's valid to use GPIO40 and I don't know if using it can have negative consequences.

jlit

comment created time in 15 days

issue closedfivdi/lcd

configuration issue with i2c on raspberry pi 2 model b

Hi, is it possibile to use this module on a raspberry pi 2, with a i2c connector? I can't make it working...i'm sure it's a configuration error about gpio pins. I'm reading this tutorial https://tutorials-raspberrypi.com/control-a-raspberry-pi-hd44780-lcd-display-via-i2c/

I have 4 gpio (gnd, vcc, sda, scl) but i can't configure the lcd constructor in the right way. Do you have any suggestions?

thanks!

closed time in 18 days

wiulma

issue commentfivdi/lcd

configuration issue with i2c on raspberry pi 2 model b

Hi, is it possibile to use this module on a raspberry pi 2, with a i2c connector?

Hi @wiulma, no it is not possible to use this module with an i2c connector. It is only possible to use this module with the LCDs parallel interface. See here.

wiulma

comment created time in 20 days

issue commentfivdi/onoff

Pi hangs w/ buster when pin value changes

This appears to be a related issue https://github.com/raspberrypi/linux/issues/2550, however onoff doesn't appear to suffer from this issue.

jlit

comment created time in 20 days

issue commentraspberrypi/linux

4.14 freezes when GPIO is pulled high

The ioctl-based libgpiod API should easily outperform the sysfs API.

While this is likely to be the case in many scenarios, I'm not sure if it will be the case with Node.js. In Node.js applications there is normally only one JavaScript thread and blocking calls in this thread are regarded as being a bad practice. Under the covers, onoff uses epoll to detect state changes. It looks like libgpiod uses ppoll to detect state changes. To avoid blocking the JavaScript thread, it's necessary to start a C/C++ thread in the background. This background thread can then make blocking epoll/ppoll calls. When the background thread detects a state change, it needs to inform the JavaScript thread about the state change. This results in context switching between the threads which comes with a cost. I'm not sure if using libgpiod in combination with ppoll will be any faster than sysfs in combination with epoll.

@pelwell why do you think the libgpiod API should easily outperform the sysfs API for state change notifications?

antroseco

comment created time in 20 days

issue commentraspberrypi/linux

4.14 freezes when GPIO is pulled high

I didn't test any other libraries as this one seems to be the best maintained one. Some of the other libraries haven't been updated in 2 years.

@adamreisnz onoff and pigpio are also very well maintained (even if I may say so myself :smile:)

The backend of rpio uses Mike McCauley's bcm2835 library to handle mmap()ing the /dev/{gpio,}mem bits. As far as I'm aware all the other nodejs modules use the slower /sys interface which is why they wouldn't exhibit the same issues (the reason I wrote rpio in the first place was because I wanted a faster interface than the existing modules provided).

@jperkin onoff uses the sysfs interface and can detect approximately 20,000 state changes per second with this test program on a Raspberry Pi 4. An equivalent rpio test program can detect approximately 923 state changes per second.

antroseco

comment created time in 20 days

issue closedfivdi/pigpio

Does pigpio support compute module 3 ?

Does pigpio support compute module 3 ?

closed time in 21 days

jinyistudio

issue commentfivdi/pigpio

Does pigpio support compute module 3 ?

There is no actionable for pigpio here so I'll go ahead and close the issue.

jinyistudio

comment created time in 21 days

issue closedfivdi/onoff

Just a question: Now to test of new GPIO pin assignment fails?

What is the best practice if the following line of code fails? var LED = new Gpio(4, 'out');

Should I test for null or undefined? Thinking should test for null, right? Or is an exception just thrown?

closed time in 21 days

Nodi-Rubrum

issue commentfivdi/onoff

Just a question: Now to test of new GPIO pin assignment fails?

@johntalton Thank you for providing all the useful feedback.

@Nodi-Rubrum I'll go ahead and close this issue as I think all the required information has been provided.

Nodi-Rubrum

comment created time in 21 days

issue commentfivdi/onoff

Pi hangs w/ buster when pin value changes

This is the first time I've heard of this issue and I'm unable to reproduce the issue with the onoff integration tests on Buster.

Please provide a simple but complete program that can be used to reproduce the issue.

Please also provide the output of the following commands when run on the Raspberry Pi:

cat /etc/debian_version
uname -a
node -v
jlit

comment created time in 21 days

issue commentfivdi/pigpio

Does pigpio support compute module 3 ?

  1. CM3 is ok.

Thank you for confirming this to be the case.

node .js with sudo

Yes, this is correct. sudo is required by the underlying pigpio C library.

  1. I need as root when i porting to NODE-RED as node. Do you know how to run as root in the NODE-RED ?

Unfortunately I'm not familiar with Node-RED. I'd suggest asking this question at the Node-RED forum (https://discourse.nodered.org/)

jinyistudio

comment created time in 22 days

issue commentfivdi/pigpio

Cannot install package on node 8.9.0

The error message shown above is:

error source-map-loader@1.0.0: The engine "node" is incompatible with this module. Expected version ">= 10.13.0". Got "8.9.0"
error Found incompatible module.

The error is occurring because source-map-loader@1.0.0 requires Node 10.13.0 or higher to function correctly but Node 8.9.0 is being used. See here.

As can he seen here, pigpio installs successfully with Node.js versions 8, 10, 12, 13 and 14.

This issue is not related to pigpio.

bmadzinski

comment created time in a month

issue closedfivdi/i2c-bus

i2c out, can't accept value outside of -128 to +127?

i2c out, can't accept value outside of range -128 to +127? To fully power on a tsl2591 sensor, required to send to command/register 0, a value of 147, which is well with in the 0 to 255 value range for a single byte. Is the following error a limit of the i2c-bus code? I receive the following error: "RangeError: The value of "value" is out of range. It must be >= -128 and <= 127. Received 147"

closed time in a month

Nodi-Rubrum

issue commentfivdi/i2c-bus

i2c out, can't accept value outside of -128 to +127?

The reason this error occurs is explained at https://github.com/nielsnl68/node-red-contrib-i2c/issues/26. See also https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458.

Closing in favour of https://github.com/nielsnl68/node-red-contrib-i2c/issues/26.

Nodi-Rubrum

comment created time in a month

issue commentfivdi/i2c-bus

How to list available adapters?

i2c-bus doesn't have an API for this purpose. However, glob and regular expressions could be used to retrieve a list of I2C bus numbers. Something like this should do it:

const glob = require('glob');

const busNumbers = glob.sync('/dev/i2c-*').
  filter(fileName => fileName.match(/\/i2c-\d+$/) != null).
  map(fileName => parseInt(fileName.match(/\d+$/)[0], 10));

console.log(busNumbers);

Here glob is used synchronously but it can also be used asynchronously. busNumbers is an array of numbers.

KnorpelSenf

comment created time in a month

issue commentfivdi/i2c-bus

i2c out, can't accept value outside of -128 to +127?

I don't think the source of this error is code in the i2c-bus module. Please post the complete stack trace so that it's possible to see where the error was thrown.

Nodi-Rubrum

comment created time in a month

issue commentfivdi/i2c-bus

Add big-endian and little-endian variants of readWord and writeWord

@johntalton Thank you for the feedback.

I have looked at this a little closer and now realize that I went off on a bit of a wild goose chase here. The issue isn't really a big-endian / little-endian issue.

Section 6.5.4 of the SMBus Specification states that the write word protocol is:

S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P

Similarly, section 6.5.5 states that the read word protocol is:

S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P

The exact position of the low byte (Bits [7:0]) and high byte (Bits [15:8]) is clearly defined. If a device adheres to the protocol and the operating system / kernel driver do their job correctly, everything will function as expected irrespective of whether the host architecture is big-endian or little-endian.

Of course, there will be devices that do not adhere to the protocol resulting in the bytes being the wrong way around. In such cases, the bytes will be the wrong way around irrespective of whether the host architecture is big-endian or little-endian.

This is further confirmed by the Linux SMBus Protocol Summary which has the following to say about i2c_smbus_read_word_data:

SMBus Read Word:  i2c_smbus_read_word_data()
============================================

This operation is very like Read Byte; again, data is read from a
device, from a designated register that is specified through the Comm
byte. But this time, the data is a complete word (16 bits).

S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P

Functionality flag: I2C_FUNC_SMBUS_READ_WORD_DATA

Note the convenience function i2c_smbus_read_word_swapped is
available for reads where the two data bytes are the other way
around (not SMBus compliant, but very popular.)

Adding four new methods to Bus and two new methods to PromisifiedBus would resolve the issue.

Add the following methods to class Bus

  • readWordSwapped
  • readWordSwappedSync
  • writeWordSwapped
  • writeWordSwappedSync

Add the following methods to class PromisifiedBus

  • readWordSwapped
  • writeWordSwapped
fivdi

comment created time in a month

startedWeActTC/MiniF4-STM32F4x1

started time in a month

issue commentserialport/node-serialport

Serialport.on('data') stops reading data / stops working after some time

To me, the program from the first post above looks like it should work correctly.

Try the following: on the Raspberry Pi, run the following command to see if there are similar communication issues:

minicom -b 19200 -D /dev/ttyUSB0 -H --wrap

Change the baudrate if required. If minicom has not been installed already it can be installed with the following command:

sudo apt-get install minicom

If there are communication issues using minicom, it's more likely to be a device issue than a serialport issue.

Another idea would be to to add the following event handlers to the program to see if there are errors:

port.on('error', function(err) {
  console.log(err);
})

port.on('close', function(err) {
  console.log(err);
});
tobschoe

comment created time in 2 months

issue commentserialport/node-serialport

Serialport.on('data') stops reading data / stops working after some time

Which serial port on the Raspberry Pi B+ is being used?

Is /dev/serial0 (or /dev/ttyAMA0) being used? This is the device corresponding to the serial port broken out to pins 8 and 10 on the Raspberry Pi header.

If /dev/serial0 (or /dev/ttyAMA0) is being used, has the login shell which is accessible over this serial port been disabled? The default behaviour on Raspberry Pi OS is for a login shell to be accessible over this serial port.

If the login shell and the JavaScript program attempt to use this serial port at the same time it will not function correctly.

The login shell which is accessible over this serial port can be disabled from the command line with the raspi-config tool.

Run the command sudo raspi-config and navigate to "5 Interfacing Options" > "P6 Serial".

Answer the question "Would you like a login shell to be accessible over serial?" with No

Answer the question "Would you like the serial port hardware to be enabled?" with Yes.

Then reboot the Pi.

tobschoe

comment created time in 2 months

issue commentserialport/node-serialport

Will you support node-serialport on 32bit machines?

Since nodejs dropped 32bit support ...

While this is true for Linux / ia32, nodejs still officially support Windows x86 and Linux armv7 which are also 32-bit.

Ks89

comment created time in 2 months

issue commentserialport/node-serialport

Will you support node-serialport on 32bit machines?

serialport 9 dropped Linux / ia32 (Intel Architecture, 32-bit) from its testing and build matrix. As shown in the Supported Platforms and Architectures section of the documentation, Windows / x86 (also 32-bit) is still supported.

serialport never officially supported any of the ARM architectures. The documentation simply states that they will probably work.

This means that serialport 9 will probably work on an NXP iMX6 (Armv7-A, 32-bit). Or are you experiencing issues here?

Ks89

comment created time in 2 months

issue commentserialport/node-serialport

Will you support node-serialport on 32bit machines?

@Ks89 which ARM 32 bit embedded device are you using?

Ks89

comment created time in 2 months

issue closedserialport/node-serialport

Error: Cannot find module '@serialport/bindings'

After restarting my machine, I'm having problems with Node Red running on Docker in Ubuntu 20.04 using an npm package that relies on Serialport

From what I understand, the npm named node-red-contrib-rfxcom@2.11.1 has a dependancy on serialport.

When Node Red starts, the following messages appear. in the log

serialport@9.0.0 postinstall /opt/node_modules/serialport node thank-you.js

Thank you for using serialport! If you rely on this package, please consider supporting our open collective:

https://opencollective.com/serialport/donate

  • node-red-contrib-rfxcom@2.11.1 added 5 packages from 4 contributors and audited 1074 packages in 4.707s

37 packages are looking for funding run npm fund for details

found 4 low severity vulnerabilities run npm audit fix to fix them, or npm audit for details [cont-init.d] user.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [13:42:08] INFO: Starting Node-RED...

addon-node-red@ start /opt node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"

22 Jul 13:42:08 - [info]

Welcome to Node-RED

22 Jul 13:42:08 - [info] Node-RED version: v1.1.0 22 Jul 13:42:08 - [info] Node.js version: v12.17.0 22 Jul 13:42:08 - [info] Linux 5.4.0-40-generic x64 LE 22 Jul 13:42:09 - [info] Loading palette nodes 22 Jul 13:42:10 - [info] Dashboard version 2.22.1 started at /endpoint/ui /bin/sh: /opt/node_modules/node-red-node-pi-gpio/testgpio.py: not found 22 Jul 13:42:10 - [warn] rpi-gpio : Raspberry Pi specific node set inactive 22 Jul 13:42:10 - [warn] ------------------------------------------------------ 22 Jul 13:42:10 - [warn] [node-red-contrib-rfxcom/rfxcom] Error: Cannot find module '@serialport/bindings' Require stack:

  • /opt/node_modules/serialport/lib/index.js
  • /opt/node_modules/rfxcom/lib/rfxcom.js
  • /opt/node_modules/rfxcom/lib/index.js
  • /opt/node_modules/rfxcom/index.js
  • /opt/node_modules/node-red-contrib-rfxcom/rfxcom.js
  • /opt/node_modules/@node-red/registry/lib/loader.js
  • /opt/node_modules/@node-red/registry/lib/index.js
  • /opt/node_modules/@node-red/runtime/lib/nodes/index.js
  • /opt/node_modules/@node-red/runtime/lib/index.js
  • /opt/node_modules/node-red/lib/red.js
  • /opt/node_modules/node-red/red.js

node-red-contrib-rfxcom@2.11.1 Error: Cannot find module '@serialport/bindings'

If I run "npm install serialport@latest" within the console of the docker container, the following appears

root@a0d7b954-nodered:/root/.npm/_logs$ npm install serialport@latest

@serialport/bindings@9.0.0 install /root/.npm/_logs/node_modules/@serialport/bindings prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=12.17.0 runtime=node arch=x64 libc=musl platform=linux) gyp ERR! build error gyp ERR! stack Error: not found: make gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12) gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16 gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5 gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5 gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21) gyp ERR! System Linux 5.4.0-40-generic gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /root/.npm/_logs/node_modules/@serialport/bindings gyp ERR! node -v v12.17.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open '/root/.npm/_logs/package.json' npm WARN _logs No description npm WARN _logs No repository field. npm WARN _logs No README data npm WARN _logs No license field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @serialport/bindings@9.0.0 install: prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @serialport/bindings@9.0.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-07-22T17_13_14_247Z-debug.log

Do you have any guidance on how I can fix this?

closed time in 2 months

jag100UK

issue commentserialport/node-serialport

Problem with baudRate

The options should be passed as the second argument to the constructor rather than as the third argument in the sample code above. In other words, this should work:

const SerialPort = require('serialport')
const config = require('./config/config')

const port = new SerialPort(config.serialpath, {
  baudRate: 19200,
  dataBits: 8,
  stopBits: 1,
  Parity: 'none',
  flowControl: false
}, function (err) {
  if (err) {
    return console.log('Error: ', err.message)
  }
})

port.on('open', function () {
  console.log('port open. Data rate: ' + port.baudRate)
})
tobschoe

comment created time in 2 months

issue closedfivdi/onoff

Bug or Design? Noticed that unexport() leaves given pin in a floating state? This is typically not a best practice?

Bug or Design? Noticed that unexport() leaves given pin in a floating state? This is typically not a best practice? If I explicitly set the pin for output, the floating condition is avoided. It is my understanding that the default state for most pins on Pi hardware start up is set for output, no? This avoids pin floating.

closed time in 2 months

dachshund-digital

issue commentfivdi/onoff

Bug or Design? Noticed that unexport() leaves given pin in a floating state? This is typically not a best practice?

Thanks for taking the time to answer my question, and moreover, doing active support of the 'onoff' module.

You're welcome :smile:

dachshund-digital

comment created time in 2 months

issue closedfivdi/onoff

UncaughtException: EPERM: operation not permitted

I am using


var Gpio = require('onoff').Gpio; //include onoff to interact with the GPIO
var liveA = new Gpio(21, 'out');
var liveB = new Gpio(26, 'out');
var liveC = new Gpio(19, 'out');
var liveD = new Gpio(13, 'out');
var relay1 = new Gpio(16, 'out');

then code is working fine but when i

var relay2 = new Gpio(20, 'out'); and do


function a (){
        relay2.writeSync(1);
}
a();

It is giving me error

{ error:
   { Error: EPERM: operation not permitted, write
  at Object.writeSync (fs.js:573:3)
        at Gpio.writeSync (/home/../node_modules/onoff/onoff.js:243:8)
         at Timeout.blinkLED [as _onTimeout] (/home/..../utilities.js:87:16)
        at ontimeout (timers.js:436:11)
       at tryOnTimeout (timers.js:300:5)
        at listOnTimeout (timers.js:263:5)
        at Timer.processTimers (timers.js:223:10) errno: -1, syscall: 'write', code: 'EPERM' },
   level: 'error',

Any idea whats going wrong ?

closed time in 2 months

rajanlagah

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

That is not the output. That was copied that from here. I'm afraid I can't provide any further help, good luck.

rajanlagah

comment created time in 2 months

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

What is the output of this program when you run it?

rajanlagah

comment created time in 2 months

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

What is the output of that program when you run it? Were is stage defined?

rajanlagah

comment created time in 2 months

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

As mentioned above, please post a complete (but short) program that can be run and used to reproduce the error rather than snippets of code.

I'm afraid I can't provide any help without a complete (but short) program that can be used to reproduce the error.

rajanlagah

comment created time in 2 months

issue commentfivdi/i2c-bus

Add big-endian and little-endian variants of readWord and writeWord

Given that an implementation exists on Buffer ... is this appropriate.

Yes, I think it is appropriate. Class Bus already has the methods readWord, readWordSync, writeWord and writeWordSync. In addition, class PromisifiedBus already has methods readWord and writeWord. The current implementations of these methods are either all big-endian or all little-endian, I can't actually recall which. Curently, none of these methods rely on Buffer. The readWord* methods return a number and the writeWord* methods are passed a number. This is a simple interface and it should stay that way. Modifying the interfaces of these methods to use Buffers rather than numbers would make things more complex and more difficult to use.

in fact, preferences would be to see the API reduce the nodejs deps and return ArrayBuffer or one of the TypedArray's. but alas, i do not have that PR ready :)

As mentioned, the APIs which are the subject of this issues rely on numbers rather than Buffers which makes the interface simpler and easier to use so it should stay that way. There are other methods that rely on Buffers but that would be a different issue. What I don't want to do is make breaking changes to any of the APIs.

fivdi

comment created time in 2 months

issue commentfivdi/onoff

Bug or Design? Noticed that unexport() leaves given pin in a floating state? This is typically not a best practice?

In this case it's ok to allow the program to terminate without calling unexport. The sysfs files located at /sys/class/gpio that are used to control the pins will remain there after the program has terminated. On program termination, outputs will remain configured as outputs and inputs will remain configured as inputs.

dachshund-digital

comment created time in 2 months

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

@rajanlagah Any news on this one?

rajanlagah

comment created time in 2 months

issue commentfivdi/onoff

Bug or Design? Noticed that unexport() leaves given pin in a floating state? This is typically not a best practice?

the default state at power up, most GPIO pins on a Pi device are floating, unless explicitly assigned as in or out mode.

This is not the case. As already mentioned above, most pins on a Pi are explicitly configured as in pins on power up.

My point or question is, should you code not explicitly default to out mode, so the given pins are not floating.

No, the code should definitely not explicitly default to out mode. This is highly likely to result in short circuits. For example, assume GPIO17 (or any other GPIO) is connected to a 3V3 power source. If GPIO17 is configured as an output and it's value is set to 0V we have a short circuit.

It is not a matter of providing anything.

I see this a little differently.

If I use you code, I explicitly see the given pins in question return to a floating state, when I call unexported() to release the pins from control.

You need to see this from my perspective. All I know is that you are having an issue with some circuit. Regarding this circuit and the code that is used to control it I am completely in the dark. I have no idea what the concrete problem is. If you explain what the circuit should do and what it does do we may be able to resolve the issue.

dachshund-digital

comment created time in 2 months

issue commentfivdi/onoff

Bug or Design? Noticed that unexport() leaves given pin in a floating state? This is typically not a best practice?

Noticed that unexport() leaves given pin in a floating state?

I don't believe this to be the case.

  • Please provide a short and complete program which can be used to reproduce this behaviour.
  • Please explain how you verified that the given pin is floating.

It is my understanding that the default state for most pins on Pi hardware start up is set for output, no? This avoids pin floating.

This is not my understanding. My understanding is that most pins are configured as input pins by default and have either their internal pullup or pulldown resistor activated. It is also my understanding that calling unexport for a pin will configure the pin as an input without modifying the state of it's pullup or pulldown resistor which implies that it should not be floating.

dachshund-digital

comment created time in 2 months

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

If GPIO20 is configured as an output and later configured as an input, calling writeSync for GPIO20 will result in an EPERM error. This is to be expected as it's not permitted to call writeSync for a GPIO configured as an input.

For example, running this program:

const Gpio = require('onoff').Gpio;

const relay2 = new Gpio(20, 'out');
const input = new Gpio(20, 'in');

function a() {
  relay2.writeSync(1);
}

a();

results in this EPERM error:

internal/fs/utils.js:259
    throw err;
    ^

Error: EPERM: operation not permitted, write
    at Object.writeSync (fs.js:694:3)
    at Gpio.writeSync (/home/pi/onoff/node_modules/onoff/onoff.js:243:8)
    at a (/home/pi/onoff/t.js:7:10)
    at Object.<anonymous> (/home/pi/onoff/t.js:10:1)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -1,
  syscall: 'write',
  code: 'EPERM'
}
rajanlagah

comment created time in 2 months

issue commentfivdi/onoff

UncaughtException: EPERM: operation not permitted

What type of system is the error occurring on? A Raspberry Pi 0, 1, 2, 3 or 4? A BeagleBone? Something else?

If a Raspberry Pi with a 40-pin GPIO header is being used please ensure that the SPI1 peripheral is not activated for usage as activating SPI1 will reserve GPIO20 for SPI thus making it unusable for other purposes.

Please post a complete (but short) program that can be run and used to reproduce the error rather than snippets of code.

Please post the content of /boot/config.txt

rajanlagah

comment created time in 2 months

issue commentfivdi/mcp-spi-adc

Max sampling rate?

The max. sampling rate will depend on many factors, for example:

  • The Node version
  • The Linux version
  • The SPI device driver
  • The board (Raspberry Pi 0, 1, 2, 3 or 4, BeagleBone, BeagleBone Black, ...)
  • The system load
  • ...

The below program samples the voltage on channel 4 of an MCP3008 and prints the number of samples per second.

const mcpadc = require('mcp-spi-adc');
const assert = require('assert');

let voltageReading;
let samplesPerSec = 0;

const voltageSensor = mcpadc.open(4, err => {
  assert(!err, 'can\'t open voltage sensor');

  const next = _ => {
    voltageSensor.read((err, reading) => {
      assert(!err, 'can\'t read voltage sensor');
      voltageReading = reading;
      samplesPerSec += 1;
      next();
    });
  };

  next();
});

setInterval(_ => {
  console.log(
    'samples per sec: ' + samplesPerSec +
    ', v: ' + (voltageReading.value * 3.3)
  );

  samplesPerSec = 0;
}, 1000);

If this program is run using Node 14 on a Raspberry Pi 2 running Linux raspberrypi 4.19.57-v7+ with no additional system load it prints the following:

samples per sec: 3667, v: 1.6580645161290322
samples per sec: 3935, v: 1.6548387096774193
samples per sec: 4207, v: 1.6580645161290322
samples per sec: 4178, v: 1.661290322580645
samples per sec: 4168, v: 1.661290322580645
samples per sec: 4307, v: 1.661290322580645
samples per sec: 4481, v: 1.661290322580645
samples per sec: 4459, v: 1.661290322580645
samples per sec: 4390, v: 1.6580645161290322
samples per sec: 4319, v: 1.6580645161290322
samples per sec: 4021, v: 1.6580645161290322
samples per sec: 4226, v: 1.6580645161290322
samples per sec: 4198, v: 1.6580645161290322
samples per sec: 4255, v: 1.6580645161290322
samples per sec: 4404, v: 1.6580645161290322
samples per sec: 4429, v: 1.6580645161290322
samples per sec: 4443, v: 1.6580645161290322
samples per sec: 4402, v: 1.6580645161290322
samples per sec: 4478, v: 1.6580645161290322
samples per sec: 4480, v: 1.6580645161290322
samples per sec: 4481, v: 1.6580645161290322
samples per sec: 4432, v: 1.6548387096774193
samples per sec: 4472, v: 1.6580645161290322
samples per sec: 4473, v: 1.6580645161290322
samples per sec: 4424, v: 1.6580645161290322
samples per sec: 4470, v: 1.6548387096774193
samples per sec: 4477, v: 1.6548387096774193
samples per sec: 4399, v: 1.6548387096774193
samples per sec: 4465, v: 1.6548387096774193
samples per sec: 4467, v: 1.6548387096774193
samples per sec: 4471, v: 1.6580645161290322
samples per sec: 4427, v: 1.6548387096774193
samples per sec: 4473, v: 1.6548387096774193
samples per sec: 4463, v: 1.6580645161290322
samples per sec: 4430, v: 1.6580645161290322
samples per sec: 4486, v: 1.6548387096774193
samples per sec: 4549, v: 1.6580645161290322
samples per sec: 4495, v: 1.6580645161290322
samples per sec: 4548, v: 1.6580645161290322
samples per sec: 4542, v: 1.6548387096774193
samples per sec: 4514, v: 1.6580645161290322
samples per sec: 4545, v: 1.6580645161290322
samples per sec: 4545, v: 1.6580645161290322
samples per sec: 4432, v: 1.6580645161290322
samples per sec: 4468, v: 1.6580645161290322
samples per sec: 4474, v: 1.6580645161290322
samples per sec: 4475, v: 1.6580645161290322
...

Give the program a try on your system to see what's possible.

Note that Linux is not a real time operating system so there are no guarantees about timing.

ZaneL

comment created time in 2 months

issue closedfivdi/mcp9808-temperature-sensor

To a new student to node.js your example is completely confusing!

To a new student to node.js your example is completely confusing! It so de-referenced and abstracted it impossible to understand. How about a simple example that does leverage javascript unique language features to the extreme?

closed time in 2 months

dachshund-digital

issue commentfivdi/mcp9808-temperature-sensor

To a new student to node.js your example is completely confusing!

The mcp9808-temperature-sensor module relies on asynchronous promise-based behavior so familiarity with promises is going to be necessary if you would like to use mcp9808-temperature-sensor. The async and await keywords enable asynchronous promise-based behavior to be written in a cleaner style avoiding the need to explicitly configure promise chains.

Assuming that the example being referred to is this one:

const mcp9808 = require('mcp9808-temperature-sensor');

mcp9808.open().then(sensor =>
  sensor.temperature().
  then(temp => console.log(temp.celsius + '°C')).
  then(_ => sensor.close())
).catch(console.log);

an alternative syntax using the async and await keywords that is likely to be easier to understand is (tested with Node 14):

const mcp9808 = require('mcp9808-temperature-sensor');

async function readTemperature() {
  let sensor = await mcp9808.open();
  let temperature = await sensor.temperature();
  console.log(temperature);
  await sensor.close();
}

readTemperature().catch(function (err) {
  console.log(err);
});
dachshund-digital

comment created time in 2 months

startedfivdi/lcd

started time in 2 months

issue commentserialport/node-serialport

Error: Cannot find module '@serialport/bindings'

The messages that are now being shown are warnings rather than errors and can be ignored.

jag100UK

comment created time in 2 months

issue commentserialport/node-serialport

Error: Cannot find module '@serialport/bindings'

I'm running on an Intel NUC with Ubuntu 20.04 LTS and Docker I'm not sure why Raspberry Pi is mentioned in the logs

Ok. It's probably not important.

I'm afraid I'm not familiar with configuring Node-RED and Docker images.

prebuild-install WARN install No prebuilt binaries found (target=12.17.0 runtime=node arch=x64 libc=musl platform=linux) gyp ERR! build error gyp ERR! stack Error: not found: make

All I can see from the error messages is that the make utility is not available when an attempt is being made to build serialport from source code. You'll need to figure out how to ensure the prerequisites for building Node native modules are available. As mentioned above the prerequisites are (to the best of my knowledge) make, g++ and python.

I also tried specifying "make" in the config file along with some other modules which have been recommended on the Home Assistant forum, but this hasn't worked either

What is the exact error message displayed after specifying make in the config file?

jag100UK

comment created time in 2 months

issue commentserialport/node-serialport

Error: Cannot find module '@serialport/bindings'

gyp ERR! stack Error: not found: make

It looks like the make utility is not installed on the Raspberry Pi. In order to build serialport from source code a number of packages need to be installed. If I remember correctly these packages are python, g++ and make.

jag100UK

comment created time in 2 months

issue closedfivdi/pigpio

Array support

I have tried to address the GPIO outputs in an array in order to provide a way of controlling GPIO peripherals.

const outputDevice = []; outputDevice.push = new Gpio(23, {mode: Gpio.OUTPUT}); outputDevice.push = new Gpio(24, {mode: Gpio.OUTPUT}); outputDevice.push = new Gpio(25, {mode: Gpio.OUTPUT}); outputDevice.push = new Gpio(22, {mode: Gpio.OUTPUT});

and then using...

outputDevice[0].digitalWrite(1);

But I try this approach I get the following error "Property 'digitalWrite' does not exist on type 'never'.ts(2339)"

closed time in 2 months

IanW69

issue commentfivdi/pigpio

Array support

Good to hear that it's working now with JavaScript. I guess you'll have to take a look at some tutorials to figure out what needs to be done for TypeScript. I'll go ahead and close the issue now as it isn't related to pigpio.

IanW69

comment created time in 2 months

issue commentfivdi/pigpio

Array support

I'm not familiar with typescript and can't tell you if the sample code posted is valid TypeScript. It looks like valid JavaScript to me. This makes me wonder why you are compiling it with the TypeScript compiler and questioning if it's even necessary to do that.

Assuming that the code is in a file called index.js, what happens if you run the command sudo node index.js

IanW69

comment created time in 2 months

issue commentfivdi/pigpio

Array support

Are you JavaScript / TypeScript beginner? Please post a complete but short JavaScript program that can be used to reproduce the error.

IanW69

comment created time in 2 months

issue commentfivdi/pigpio

Array support

The Array push() method is being used incorrectly.

In other words, this:

 outputDevice.push = new Gpio(23, {mode: Gpio.OUTPUT});

Should be:

 outputDevice.push(new Gpio(23, {mode: Gpio.OUTPUT}));
IanW69

comment created time in 2 months

issue closedfivdi/i2c-bus

Error: ENXIO, No such device or address on writeByteSync

I'm having a strange error in that function:

(node:3168) UnhandledPromiseRejectionWarning: Error: ENXIO, No such device or address at Bus.writeByteSync (/root/domoticize/node_modules/i2c-bus/i2c-bus.js:411:9) at SI1132.reset (/root/domoticize/si1132.js:179:19) at SI1132.initialize (/root/domoticize/si1132.js:129:12) at SI1132.init (/root/domoticize/si1132.js:96:7)

But if I put a console.log in the function, it works.. and doesn't give any error. Any idea?

I added this to the start of the function to check the data. console.log(${addr} ${cmd} ${byte});

If I leave that console.log it wont throw an error.. maybe it's some sync issue here.

closed time in 2 months

YindSoft

issue commentfivdi/i2c-bus

Error: ENXIO, No such device or address on writeByteSync

This doesn't appear to be an i2c-bus problem so I'll go ahead and close the issus.

YindSoft

comment created time in 2 months

issue closedfivdi/i2c-bus

Please update your code to address deprecated Buffer() call use

Please update your code to address deprecated Buffer() call use. Following warning now results when using your module.

(node:14197) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

closed time in 2 months

dachshund-digital

issue commentfivdi/i2c-bus

Please update your code to address deprecated Buffer() call use

As mentioned above there are no deprecated usages of Buffer() in the current i2c-bus codebase so I'll go ahead and close the issue.

dachshund-digital

comment created time in 2 months

issue commentfivdi/pigpio

Is there a way to run an app using pigpio without root permissions

The pigpiod_if2 interface isn't a drop in replacement for the pigpio C interface and functions that are used to achieve the same thing, for example, gpio_read from the pigpiod_if2 interface and gpioRead from thepigpio C interfaces are named differently and have different parameter lists.

In addition, the pigpio C interface is non-blocking and can be called synchronously but the pigpiod_if2 interface is blocking and should be called asynchronously.

In other words, achieving what you would like to achieve would be a significant amount of work.

jrgleason

comment created time in 2 months

issue commentfivdi/i2c-bus

Error: ENXIO, No such device or address on writeByteSync

If adding a small amount of code that logs to the console works-around the issue then maybe it's a timing issue. I'm not familiar with the Si1132 sensor but section 4.2 Command Protocol of the datasheet does indicate that the sensor has special timing constraints. Does your code fulfill all the timing requirements specified in the datasheet?

YindSoft

comment created time in 3 months

issue commentfivdi/i2c-bus

Please update your code to address deprecated Buffer() call use

There are no deprecated usages of Buffer() in the current i2c-bus codebase or at least I can't find any. What version of i2c-bus are you using? Perhaps there were deprecated usages of Buffer() in older versions of i2c-bus. Can you provide code that can be used to reproduce the issue?

dachshund-digital

comment created time in 3 months

issue commentserialport/node-serialport

Memory leak on Raspberry Pi4 with Raspbian

Is there anything one can find out if a port is UART like a property that can be read after opening the port?

To the best of my knowledge all serialports are UARTs. Bluetooth uses a UART and the serialport broken out to pins 8 and 10 on the GPIO header is a UART. I don't know if node-serialport can be used to determine if a serialport on a Raspberry Pi is for Bluetooth. Perhaps there is information related to the topic in the data returned by SerialPort.list().

Fuzzzzel

comment created time in 3 months

issue commentrwaldron/johnny-five

lcd.cursor is not updating correctly with condition loop

The valid visible column positions on a 16x2 LCD display are 0 through 15, however

on the 17th iteration of the loop n === 16 and n is passed to lcd.cursor as the column position but there is no visible column 16 on the 18th iteration of the loop n === 17 and n is passed to lcd.cursor as the column position but there is no visible column 17 ... on the 33rd iteration of the loop n === 32 and n is passed to lcd.cursor as the column position but there is no visible column 32 on the 34rd iteration of the loop n === 33 and n is passed to lcd.cursor as the column position but there is no visible column 33 ...

The following line of code in the loop most likely doesn't do what it is expected to do. It tells the JavaScript run-time to run an empty function that does nothing in one second. It doesn't delay program execution for one second which I think is the intention.

            setTimeout(() => {  }, 1000);
theoriginalkaiju

comment created time in 3 months

issue commentserialport/node-serialport

Memory leak on Raspberry Pi4 with Raspbian

When using Raspberry Pi OS on a Raspberry Pi 4, /dev/ttyAMA0 is the default Bluetooth UART. By default /dev/serial1 is a link to /dev/ttyAMA0 so it's the same device.

Running the following command from the command line does the same thing as the test code in the first post above:

echo TESTDATA > /dev/ttyAMA0

Running this command from the command line also results in issues. It doesn't result in memory leaks but it does result in the corresponding bash process blocking one of the 4 CPUs on the Pi 4 requiring 100% CPU.

Do you really want to use the Bluetooth UART and not the UART broken out to pins 8 and 10 on the Raspberry Pi GPIO header?

If the test program is modified to use /dev/ttyS0 (or /dev/serial0) then the test program will function as expected and the UART broken out to pins 8 and 10 on the Raspberry Pi GPIO header will transmit the string TESTDATA successfully.

Fuzzzzel

comment created time in 3 months

issue commentrwaldron/johnny-five

Query not returning callback

If a Pin is created and its mode is set to INPUT or ANALOG then its value property will be updated at regular intervals by Johnny-Five automatically. However, there may be issues if the value is accessed before Johnny-Five has a chance to update it for the first time. If the value is accessed before Johnny-Five has updated it for the first time then Johnny-Five will say that the value is 0 although it may be 1. It's possible to workaround this issue by adding a short delay before accessing value for the first time. The below program attempts to show this.

var five = require('johnny-five');
var BeagleBone = require('beaglebone-io');

var board = new five.Board({
  io: new BeagleBone()
});

board.on('ready', function() {
  var pin = new five.Pin({
    pin: 'P8_29',
    mode: this.MODES.INPUT
  });

  console.log('pin.value (may print incorrect value): ' + pin.value);
  console.log('readSync() HACK (will print correct value): ' + board.io._pins[board.io.normalize('P8_29')].gpio.readSync());
  setInterval(function () {
    console.log('pin.value (will print correct value): ' + pin.value);
  }, 1000);
});

This program also shows a terrible hack that relies on implementation details of beaglebone-io that could also be used to workaround the issue.

fencer

comment created time in 3 months

issue commentjulianduque/beaglebone-io

Add queryPinState support

The Johnny-Five IO Plugins Specification doesn't mention that an IO Plugin is required to implement queryPinState and I'm not aware of any IO Plugin other than Firmata.js that implements queryPinState.

fencer

comment created time in 3 months

issue commentxpack-dev-tools/arm-none-eabi-gcc-xpack

The GDB Text User Interface

The GDB Text User Interface works well for me with xPack GNU Arm Embedded GCC v9.3.1-1.1.

fivdi

comment created time in 3 months

more