Notifications
Clear all

hardware debugging for Arduino Nano 33 IoT -which IDE to use?

24 Posts
3 Users
5 Likes
2,255 Views
wwjd777
(@wwjd777)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

I'm trying to learn more C++ skills so I would like to use a hardware debugger to see what is happening, especially when using libraries like Timelib etc.  I'm learning the most from observing what's happening so it should be a great help.

I ordered a very affordable 'SEGGER J-Link EDU Mini' to do hardware debugging on the Arduino Nano 33 Iot which will be my 'default' board for new projects.

image

There are a few IDE's capable to do hardware debugging as I understand it:

  1. Arduino IDE 2.x
  2. Visual Studio with Visual Micro and   oops, not available for Linux...
  3. Visual Studio Code with PlatformIO
  4. ??

QUESTION:  does anybody has any experience with hardware debugging and if so can you recommend which IDE to use?  I already use platformIO for a while but I read that Visual Micro is easier/better?? 

Any other tips are appreciated. 

 


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

I am curious, as someone who was hardware and software (OS) trained in my professional life with big computers, I only remember one time when I had to use an oscilloscope and hardware knowledge to resolve a problem (the ground pin needed to be grounded !!!! bizarre) So I am curious as to how the hardware debugger will help with software debugging.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 
Posted by: @wwjd777

affordable

$1,000 is affordable???

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
wwjd777
(@wwjd777)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@ronalex4203 I would love to have your knowledge and training. 

But for me as an untrained person in both hardware and software it will be very valuable (I hope). I can stop the sketch at any point and see in real time the variable values and I also can follow sketch execution line by line to see what is happening. No more 'Serial.print' to see the variable values.

The Radio Controlled clock below was my first project I made with my own written code after the 'blink' sketch became boring. But it took me a whopping year to make. 😞 

I learn by trial and error mostly but still can enjoy my hobby  🙂

image

 


   
ReplyQuote
wwjd777
(@wwjd777)
Member
Joined: 2 years ago
Posts: 20
Topic starter  
Posted by: @ronalex4203
Posted by: @wwjd777

affordable

$1,000 is affordable???

The (Genuine) J-Link I bought is 19 Euro's.  👍 

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

@wwjd777 WOW, very impressive. How do you deal with the RISC code that is 'out of order' in optimized library modules. I assume you do not optimize your code until debugged, but you mentioned libraries which are fully optimized unless you made a local copy that wasn't optimized.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

@wwjd777 My bad, I failed to note the MINI, yes, on your link it is listed at $18USD. That is as you say affordable. Can you recommend a YT video that shows one in action, I have never seen such a thing before, we didn't use anything like that in IT, and only used an oscilloscope for debugging mainframes back in the late 60's.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
wwjd777
(@wwjd777)
Member
Joined: 2 years ago
Posts: 20
Topic starter  
Posted by: @ronalex4203

@wwjd777 WOW, very impressive. How do you deal with the RISC code that is 'out of order' in optimized library modules. I assume you do not optimize your code until debugged, but you mentioned libraries which are fully optimized unless you made a local copy that wasn't optimized.

I don't understand a thing from what you asked (RISC code, optimisation) ... LOL   That's why I would love to have your knowledge!  I think you have more skills developed just because there were so little tools available? You HAD to rely on analytical thinking a lot. amazing.

I only have enough "knowledge" to make fun and practical things and at nearly 60 yrs for me that's already a lot.

As for the debugger in practice, I can recommend the Segger YT channel and for example this video?

I will follow up with my experience here if I receive the J-link and get it to work...

 


   
ReplyQuote
wwjd777
(@wwjd777)
Member
Joined: 2 years ago
Posts: 20
Topic starter  
Posted by: @ronalex4203

 I have never seen such a thing before, we didn't use anything like that in IT, and only used an oscilloscope for debugging mainframes back in the late 60's.

I have another example: I want to update the Bathroom Fan Controller I made with a few other functions and colour screen.

image

I am now busy coding the individual sketch segments like input of the Wi-Fi credentials via a menu system instead of hard coding it.  This will be useful when I give a controller (or other hardware) to say a family member who then can input their own credentials locally.

In the case of this piece of code, I had put many tft.print statements in code to see what was happening with jumping State. On the TFT screen you'll see these variables

Now IF the hardware debugger will work as I hope it will, I can see all that and more in real time... 😀 

to be continued...

click to see big image:

image

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

@wwjd777 I am looking forward to your updates to this project. I have 2 roof fans with rain sensors and temp driven speed control and on/off thermostat like function. What it is missing is humidity control. I hope to start experimenting with a couple sensors today and if/when I can get them to perform the way I think they should, I will figure out how to integrate that into the existing fan. My concern is it's IR controlled and some manual controls covered by structure so finding a way to 'tap in' will be the main challenge.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@ronalex4203 

Why wouldn't you make it completely autonomous ?

Are you testing for accuracy or dependability ?

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

@will I will test 2 different sensors but am pretty sure the BME280 will be more accurate than the DHT11. I just need to see for myself.

Not 100% sure what you mean by autonomous, what I meant is that the fan can turn on via the temp OR the humidity plus manual. A bonus will be to control fan speed based on humidity level similar to temp level.

Is that what you meant, or different?

It just occurred to me that it might be possible to use the BME Barometric Pressure sensor to predict upcoming rain and higher humidity, that would be interesting. Base it on jerk of the pressure sensor might work.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@ronalex4203 

I'm lazy, so I wasn't thinking of being able to turn it on and off manually 🙂 I'd just let it turn itself on and off as required (except for tapping the bathroom lights as a power source so it wouldn't cycle due to weather alone but just when the bathroom was in use).

Controlling fan speed by humidity should be possible since you're running on DC power to start, just calculate a suitable array of PWM values for 5% increments in humidity (full power at 100%).

As for accuracy, does it really matter if it triggers at 45% instead of 55% ?

Hmmm, walking into the bathroom to predict bad weather could lead to some interesting comments 🙂

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

@wwjd777 Here is an example of what I meant by RISC code optimization.

Screen Shot 2021 12 08 at 10.37.39

 The point of the (possibly poor) example is to point out that the debugger may not point at the correct source statement, or may be misleading in that the resolution isn't so obvious due to the re-ordering. I have seen both cases, and they are often a b*tch to find. Maybe I shouldn't have brought this up as it is quite advanced, but I felt you should know that it MAY be a little more complex than you imagine which is that a single line of source code does not ALWAYS result in the same machine code, or linear machine code. I am not sure if I a helping so feel free to tell me to shut up. My other reason for jumping in is as a hardware and software guy, one of those debuggers sounds like a fun tool to have for me just as education if not debugging.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
wwjd777 reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7008
 

@will Agreed re accuracy. Until I get a look behind the cover where the manual controls are I have no idea if I can 'tap in' As I said it is normally controlled either manually with the IR remote (we NEVER use the on-fan manual controls) or by setting the 'thermostat'. My fear is all I will see when I open it up is an epoxy encapsulated IR receiver/controller board. I can probably decode the DC power leads to the motor and I am fairly sure if I apply a PWM signal to those wires with appropriate back voltage (diode) protection it will  work. My concern is what happens if the humidity controller is driving the motor and then the temperature controller wants to drive the motor, or even if somebody manually tries to control it. Do multiple PWM signals 'add' thus possibly leading to an over power situation? My immediate thought is yes, so maybe a circuit that allows the humidity ON signal to block all the other signals (actually just block the DC power) does that make sense?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
wwjd777 reacted
ReplyQuote
Page 1 / 2