Debug MCU via node-red editor #13
Replies: 14 comments 42 replies
-
@ralphwetzel – Having a debugger for JavaScript is a feature. I personally cannot imagine developing a project of any complexity without one. We have that feature. I certainly wouldn't want to take it away. I understand that Node-RED generally runs without a JavaScript debugger so people working with Node-RED are accustomed to that. To maintain that experience, an option to run without xsbug would be fine. The Node-RED editor provides feedback about running projects. As I understand it, that is done using the I don't know that JavaScript debugging and display of status in the Node-RED editor need to be mutually exclusive. It seems possible that they could co-exist and that it would be valuable if they did. Would you consider inverting your suggestion? Rather than starting with the xsbug protocol, let's start by understanding the data that get sent to the Node-RED Editor for status and how that is communicated to Node-RED. Since we are not running inside the Node runtime, that's going to be quite different. |
Beta Was this translation helpful? Give feedback.
-
@phoddie |
Beta Was this translation helpful? Give feedback.
-
Ok. Here's the proposal of how to implement the .status() functionality: MCU end:
This object shall be sent (e.g. JSONized) to a server running in NR that is awaiting incoming calls. I propose to send this initially via websockets - if feasable on MCU side. Host & port data could be (transparently) provided to MCU as part of the build process. When this is operational w/ the sim, we need to find a way of how to integrate a real hardware. Do you have a proposal for a setup? NR end: |
Beta Was this translation helpful? Give feedback.
-
I wouldn't recommend using the Wi-Fi connection to carry the status information. There are some problems:
Carrying the status (and debug) data over the xsbug connection avoids both of these problems because the debugging communication with an MCU usually runs over serial. Once the status / debug data is available over the xsbug connection, then it can be relayed to Node-RED as you describe. |
Beta Was this translation helpful? Give feedback.
-
It's a very fair point to consider that MCUs (usually) use a serial connection for debugging purposes. In that case, we should concentrate on a serial protocol rather than demanding a "man in the middle" setup. If an operator yet likes to use |
Beta Was this translation helpful? Give feedback.
-
But the simulator connects to xsbug using a TCP connection. ;) A general solution needs to support both. The xsbug connection is the one place the Moddable SDK guarantees that a connection is available. From a compatibility and maintenance perspective, it is the most direct path. It also ensures that the JavaScript debugger is available when desired. |
Beta Was this translation helpful? Give feedback.
-
FWIW – I have an idea for how to implement this which I think will work well for both of our goals. I need to think about it a bit more before trying to explain. |
Beta Was this translation helpful? Give feedback.
-
@ralphwetzel, I've committed the skeleton of a possible solution.
The implementation is at The example has comments that attempt to explain the details. It is a little rough, but hopefully you can work through it. N.B. The proxy does not currently extract any messages (status or otherwise). There is a comment where that should be done. Note that message may be fragmented, especially when arriving from an MCU, so the message parsing will also need to potentially combine fragments to create a complete message. |
Beta Was this translation helpful? Give feedback.
-
OK, great! |
Beta Was this translation helpful? Give feedback.
-
Proof of concept - that still needs a lot of polishing: mcustatus.movWould it be possible to send a message through the proxy to the MCU ... to e.g. forward a button press on an inject node to the flow running on the MCU? |
Beta Was this translation helpful? Give feedback.
-
@ralphwetzel – There's an update that supports triggering an inject node over the xsbug connection.
|
Beta Was this translation helpful? Give feedback.
-
@phoddie |
Beta Was this translation helpful? Give feedback.
-
@phoddie Is there a way to enumerate (all) the possible platform identifiers (like |
Beta Was this translation helpful? Give feedback.
-
The UI update is available now. I'm not sure how this plays with your latest changes though; going to check this as a next step... |
Beta Was this translation helpful? Give feedback.
-
@phoddie
When running a flow, the NR runtime sends messages back to the editor to display display debug data.
With reference to xsbug, I see - for this feature - a significant overlap. It seems to me, that the MCU (Simulator) send messages back to xsbug, that are displayed there.
If there was a documentation of the protocol, I could create a logic that connects to the MCU (Simulator) & catches this information - to display it in the editor. This could eliminate the need to operate with an additional tool & make life easier for people...
Of course xsbug provides additional information & options - which yet might only be necessary for experienced operators.
Beta Was this translation helpful? Give feedback.
All reactions