Skip to content

Raspberry Pi 3 node app aborted #24

@cesarGlz91

Description

@cesarGlz91

Hi! Im trying to interface a relay board interfaced by a ftdi chip. At this moment i can manage to install everything correctly, read the list of ftdi devices connected, open the device and write to it. After several writes to the device im getting this errors causing my node app to abort:

*** Error in `node': free(): invalid pointer: 0x6fc004ff ***
Aborted

Also some times it outputs this:

*** Error in `node': munmap_chunk(): invalid pointer: 0x6fb0042b ***
Aborted

I tried to run this app with both scenarios: node 8.4.0 with npm 5.3.0 and node 6.11.3 with npm 3.10.10 but still i get the same results.

Im using Raspbian Stretch image on my Raspberry Pi 3

This is my test application where i simply write a random byte to the 8 relay board each second:

const ftdi = require('ftdi');
const crypto = require('crypto');
let device;

const setRandomRelays = () => {
    const buffer = crypto.randomBytes(1);
    device.write(buffer, err => {
        if (err) console.log('FTDI Write Error: ' + err);
        else console.log('FTDI Write successful: ' + buffer.toString('hex'));
    });
    setTimeout(() => setRandomRelays(), 1000);
};

ftdi.find((err, devices) => {

    if (devices.length === 0) {
        console.log("No FTDI devices found");
    } else {

        device = new ftdi.FtdiDevice(devices[0]);
        console.log(device);

        device.on('error', e => {
            console.log('FTDI error ' + e);
        });

        device.open({
                baudrate: 921600,
                databits: 8,
                stopbits: 1,
                parity: 'none',
                bitmode: 'sync', // for bit bang
                bitmask: 0xff    // for bit bang
            },
            err => {

                if (err) {
                    console.log(err);
                    return;
                }

                device.on('data', data => {
                    console.log('FTDI on data: ' + data.toString('hex'));
                });

                setRandomRelays();

            });
    }
});

this is an output of the node app:

FtdiDevice {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  deviceSettings: 
   { description: 'FT245R USB FIFO',
     serialNumber: 'A700D6Y1',
     locationId: 262,
     index: 0,
     vendorId: 1027,
     productId: 24577 },
  FTDIDevice: FtdiDevice {} }
FTDI Write successful: 40
FTDI on data: 18
FTDI Write successful: 26
FTDI on data: 40
FTDI Write successful: f3
FTDI on data: 26
FTDI Write successful: b5
FTDI on data: f3
FTDI Write successful: bf
FTDI on data: b5
FTDI Write successful: 37
FTDI on data: bf
FTDI Write successful: 82
FTDI on data: 37
FTDI Write successful: 8e
FTDI on data: 82
FTDI Write successful: 6e
FTDI on data: 8e
FTDI Write successful: b5
FTDI on data: 6e
FTDI Write successful: b2
FTDI on data: b5
FTDI Write successful: ff
FTDI on data: b2
FTDI Write successful: 4b
FTDI on data: 00
*** Error in `node': free(): invalid pointer: 0x6fc004ff ***
Aborted

Maybe it has something to do with the node addon build and my version of node-gyp. Does someone know how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions