Node-red-mcu-plugin v1.0: Integrating Node-RED MCU Edition into the Node-RED editor

I have tried playing with this. I believe that I have everything installed correctly but when I try to do a build with the plugin I get a "make: *** Waiting for unfinished jobs...." on the console and nothing ever comes back.

Oops, I am also getting some errors

/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:58:25: error: unknown type name 'mcpwm_unit_t'
 static bool pw_callback(mcpwm_unit_t mcpwm, mcpwm_capture_channel_id_t cap_sig, const cap_event_data_t *edata, void *arg);
                         ^~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:58:45: error: unknown type name 'mcpwm_capture_channel_id_t'
 static bool pw_callback(mcpwm_unit_t mcpwm, mcpwm_capture_channel_id_t cap_sig, const cap_event_data_t *edata, void *arg);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:58:87: error: unknown type name 'cap_event_data_t'
 static bool pw_callback(mcpwm_unit_t mcpwm, mcpwm_capture_channel_id_t cap_sig, const cap_event_data_t *edata, void *arg);
                                                                                       ^~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:62:50: error: unknown type name 'mcpwm_unit_t'
 static uint8_t mcpwmFromChannel(uint8_t channel, mcpwm_unit_t *unit, mcpwm_io_signals_t *signal, mcpwm_capture_signal_t *select);
                                                  ^~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:62:70: error: unknown type name 'mcpwm_io_signals_t'
 static uint8_t mcpwmFromChannel(uint8_t channel, mcpwm_unit_t *unit, mcpwm_io_signals_t *signal, mcpwm_capture_signal_t *select);
                                                                      ^~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:62:98: error: unknown type name 'mcpwm_capture_signal_t'
 static uint8_t mcpwmFromChannel(uint8_t channel, mcpwm_unit_t *unit, mcpwm_io_signals_t *signal, mcpwm_capture_signal_t *select);
                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c: In function 'xs_pulsewidth_constructor':
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:83:5: error: unknown type name 'mcpwm_unit_t'
     mcpwm_unit_t unit;
     ^~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:84:5: error: unknown type name 'mcpwm_io_signals_t'
     mcpwm_io_signals_t signal;
     ^~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:85:5: error: unknown type name 'mcpwm_capture_signal_t'
     mcpwm_capture_signal_t select;
     ^~~~~~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:154:5: error: unknown type name 'mcpwm_capture_config_t'
     mcpwm_capture_config_t conf = {
     ^~~~~~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:155:9: error: field name not in record or union initializer
         .cap_edge = MCPWM_BOTH_EDGE,
         ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:155:9: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:155:21: error: 'MCPWM_BOTH_EDGE' undeclared (first use in this function)
         .cap_edge = MCPWM_BOTH_EDGE,
                     ^~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:155:21: note: each undeclared identifier is reported only once for each function it appears in
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:156:9: error: field name not in record or union initializer
         .cap_prescale = 1,
         ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:156:9: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:156:25: warning: excess elements in scalar initializer
         .cap_prescale = 1,
                         ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:156:25: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:157:9: error: field name not in record or union initializer
         .capture_cb = pw_callback,
         ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:157:9: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:157:23: error: 'pw_callback' undeclared (first use in this function); did you mean 'xsCallback'?
         .capture_cb = pw_callback,
                       ^~~~~~~~~~~
                       xsCallback
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:157:23: warning: excess elements in scalar initializer
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:157:23: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:158:9: error: field name not in record or union initializer
         .user_data = pw
         ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:158:9: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:158:22: warning: excess elements in scalar initializer
         .user_data = pw
                      ^~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:158:22: note: (near initialization for 'conf')
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:162:13: error: request for member 'cap_edge' in something not a structure or union
         conf.cap_edge = MCPWM_NEG_EDGE;
             ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:162:25: error: 'MCPWM_NEG_EDGE' undeclared (first use in this function)
         conf.cap_edge = MCPWM_NEG_EDGE;
                         ^~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:165:13: error: request for member 'cap_edge' in something not a structure or union
         conf.cap_edge = MCPWM_POS_EDGE;
             ^
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:165:25: error: 'MCPWM_POS_EDGE' undeclared (first use in this function)
         conf.cap_edge = MCPWM_POS_EDGE;
                         ^~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c: In function 'xs_pulsewidth_destructor':
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:176:5: error: unknown type name 'mcpwm_unit_t'
     mcpwm_unit_t unit;
     ^~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:177:5: error: unknown type name 'mcpwm_io_signals_t'
     mcpwm_io_signals_t signal;
     ^~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:178:5: error: unknown type name 'mcpwm_capture_signal_t'
     mcpwm_capture_signal_t select;
     ^~~~~~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c: At top level:
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:230:25: error: unknown type name 'mcpwm_unit_t'
 static bool pw_callback(mcpwm_unit_t mcpwm, mcpwm_capture_channel_id_t cap_sig, const cap_event_data_t *edata, void *arg)
                         ^~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:230:45: error: unknown type name 'mcpwm_capture_channel_id_t'
 static bool pw_callback(mcpwm_unit_t mcpwm, mcpwm_capture_channel_id_t cap_sig, const cap_event_data_t *edata, void *arg)
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:230:87: error: unknown type name 'cap_event_data_t'
 static bool pw_callback(mcpwm_unit_t mcpwm, mcpwm_capture_channel_id_t cap_sig, const cap_event_data_t *edata, void *arg)
                                                                                       ^~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:293:50: error: unknown type name 'mcpwm_unit_t'
 static uint8_t mcpwmFromChannel(uint8_t channel, mcpwm_unit_t *unit, mcpwm_io_signals_t *signal, mcpwm_capture_signal_t *select)
                                                  ^~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:293:70: error: unknown type name 'mcpwm_io_signals_t'
 static uint8_t mcpwmFromChannel(uint8_t channel, mcpwm_unit_t *unit, mcpwm_io_signals_t *signal, mcpwm_capture_signal_t *select)
                                                                      ^~~~~~~~~~~~~~~~~~
/home/joe/Projects/moddable/modules/io/pulsewidth/esp32/_pulsewidth.c:293:98: error: unknown type name 'mcpwm_capture_signal_t'
 static uint8_t mcpwmFromChannel(uint8_t channel, mcpwm_unit_t *unit, mcpwm_io_signals_t *signal, mcpwm_capture_signal_t *select)
                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~
make: *** [/home/joe/Projects/moddable/build/tmp/esp32/saola_wroom/debug/mz5ve8vnodc/makefile:1999: /home/joe/Projects/moddable/build/tmp/esp32/saola_wroom/debug/mz5ve8vnodc/_pulsewidth.c.o] Error 1
make: *** Waiting for unfinished jobs....```

Hi @jmorris644 !
Could you share the flow you're trying to build?
I can offer to check what's happening there...

2 Likes

Just testing with an inject and debug node. Nothing else.

Thank you for the report.
I can confirm that the build fails on both saola devices.
As it looks like this is not related to Node-RED (but rather a topic of the core SDK), I've created an issue @ the Moddable repository.

Thanks! I will try another device and report back.

Hi @ralphwetzel,

Would like to start again with this, since Peter and Andy have been so kind to support the wt32-eth01 board on my request. Started from scratch again, and everything installed well (I think/hope) except your plugin:

pi@raspberrypi:~/.node-red $ npm install @ralphwetzel/node-red-mcu-plugin
npm ERR! Cannot set properties of null (setting 'peer')

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2023-01-30T22_17_13_696Z-debug-0.log

It happens both via command line or via the Node-RED palette menu.

Thanks!!

Is it this one?

Hi Julian,
Sorry just updated my question. Had posted the wrong command. Sorry for the confusion.

1 Like

Too quick for my own good :grin:

Just back in from taking my son out for a 21st birthday Thai meal so you caught me just right - or just wrong as the case may be!

1 Like

Hi @BartButenaers!
Sorry; can't reproduce this on my systems.
Could you send me the log please (PM or post it here) so I can check what causing this?

Hi @BartButenaers !
To get the support for your esp32/wt32_eth01 board, you currently need to install the latest 1.1.2-post version of the plugin, directly from GitHub:

npm install https://github.com/ralphwetzel/node-red-mcu-plugin

I don't know if this makes any difference though concerning the error you hit...

npm install ralphwetzel/node-red-mcu-plugin should be enough to install from GitHub's main branch.

Hmm, none of those commands work for me. They all give the same error, whether I download it from Github or from Npm.

I assume it is not related to Raph's package, but to my npm version. Read about other users having the same issue (for other package). Some of them posted it was resolved by upgrading from 8.15.0 to 8.16.0. Tried that but it didn't help...

Thanks for the tip!!

@ralphwetzel,

Now that your sidebar is installed, I would like to program my wt32-eth01 device.

After I have plugged the it into my Raspberry (via a CH340 TTL-USB converter) I can see this:

image

But that value isn't accepted by your sidebar:

image

Do you have any tips where I can get the correct value for that input field?

It is - well, at least it should! When you build the project, the plugin takes whatever you typed in and forwards this as port info...
The red frame is just meant to be a visual indication, that it cannot find the port given. To see the ports the plugin is aware of, place your cursor into this field and press the down arrow key.
This data yet is filtered; it might be that its filter needs to be corrected...

Ah yes, now I see:

image

When I select that it is selected:

image

Hopefully some time during the weekend to continue with this.
Thanks!!!

Not sure if I understood this correctly. Suppose you want to run some kind of simple test flow, just to see whether the whole setup is correctly installed. Can I use your two-node flow somehow for that?

Yes. Just inject a timestamp (best repetetively) & let the debug node do it's thing...

1 Like

@ralphwetzel,
Had 10 minutes time in between...
Time enough for a few remarks:

  1. When I start my flow editor, the MCU sidebar is empty in the beginning (when the MCU sidebar is my default sidebar at startup):

    image

    Not a life threatening issue. But if you should ever have too much time, to have a look at why this happens. It is only a bit confusing the first time...

  2. When a start a build for my wt32-eth01 device, I get the error "$IDF_PATH is not defined"

    image

    I think I have correctly executed all the steps to install node-red-mcu, inclusive the Espressif part. Anyway when I set the IDF_PATH environment variable on my Raspberry:

    image

    Then the same error keeps popping up in your sidebar. Do you have any idea how I could solve this?

  3. Another question about the simple Inject-Debug flow. Could you explain a bit more detailed how this works? Does the Inject node (which is triggered periodically) run on the mcu? If so, then the button of the Inject node won't be triggering messages I assume or does it somehow?

So in fact I don't really understand how an injected message arrives on the mcu, or how the mcu can show messages in the debug bar via the debug node :exploding_head: