Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Raspberry Pi Pico Debug Problem with ESP32 Prog (Read 2670 times)
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Raspberry Pi Pico Debug Problem with ESP32 Prog
Apr 12th, 2023 at 8:32am
Print Post  
Hi dear forum members,
I'm trying to debug my Pi Pico with ESP32 Prog.
When I start debugging, I see this message at the output terminal.

Code
Select All
openocd: Open On-Chip Debugger 0.10.0+dev-g18b4c35 (2021-06-24-12:15)
openocd: Licensed under GNU GPL v2
openocd: For bug reports, read
openocd: 	http://openocd.org/doc/doxygen/bugs.html
openocd: debug_level: 2
openocd:
=thread-group-added,id="i1"
GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
0x000000ea in ?? ()
Note: automatically using hardware breakpoints for read-only addresses.
@"target halted due to debug-request, current mode: Thread \n"
@"xPSR: 0x01000000 pc: 0x00000184 msp: 0x20041f00\n"

Thread 1 "" hit Breakpoint 1, main () at p2040\\4.0.2\\cores\\arduino\\main.cpp:36
36		init(); 




My first question is, why is the breakpoint set on this main.cpp? 

The second question is, I want to add a default breakpoint for pausing the program after debugging starts. How can I do it?  
« Last Edit: Apr 12th, 2023 at 8:46am by omerziya »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #1 - Apr 12th, 2023 at 8:49am
Print Post  
Thanks for the report.

Can you enable the below options:
vMicro > Uploader > Verbose
vMicro > Compiler > Verbose
vMicro > Compiler > Show Build Properties

Then perform the build and upload, and use Debug > Start to begin the debugging session.

If you can attach the complete output from the Output > Micro Build window it will help us to see the whole configuration.

If the default breakpoint is in your sketch file, you should just be able to set the breakpoint before starting the debugging session.
  
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #2 - Apr 12th, 2023 at 9:40am
Print Post  
Thanks for quick reply!
I added breakpoint and it's okay now. Thanks again.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #3 - Apr 12th, 2023 at 9:48am
Print Post  
Thanks for the output and update, it is best to attach any logging as a text file for readability and to keep the thread cleaner.

The reason it is landing on the init() code is due to the OpenOCD command being passed in "init; reset halt" which is visible in the JSON at the end of the output.

To change this to not halt immediately you can add a local board.txt to your project (vMicro > Add Code > Add Local Board.txt) and paste in the contents from the attached file.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #4 - Apr 12th, 2023 at 10:01am
Print Post  
Thanks again.
I put my breakpoint in code and debug works perfect now.
I have another question. I'm usig ESP-Prog for uploading and debugging as you know.
Now I want to open Serial Monitor while debugging. 
When I plug my Pico to PC with MicroUsb cable, I see this message on vMicro Serial Monitor: 
Code
Select All
Debug off
Port failed to open
Opening port 



Can you help me?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #5 - Apr 12th, 2023 at 10:16am
Print Post  
Have you selected the correct COM port?

The ESP-PROG will present a COM Port (for when using Serial Passthrough wiring), as well as your RP2040 board presenting its own COM port.

Also ensure you let the code run beyond Serial.begin() and allow it to run when connecting the Serial Monitor (as the when on a breakpoint the CPU is completely halted meaning no Serial negotiation can happen). Once it is connected you can then stop at the relevant lines of code.
  
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #6 - Apr 12th, 2023 at 11:38am
Print Post  
Quote:
Have you selected the correct COM port?
Yes, I think.

Quote:
The ESP-PROG will present a COM Port (for when using Serial Passthrough wiring), as well as your RP2040 board presenting its own COM port.

I tried ESP-Prog COM Port but I couldn't read monitor, then I tried to connect Pico directly with MicroUsb cable but I couldn't read either.

Quote:
Also ensure you let the code run beyond Serial.begin() and allow it to run when connecting the Serial Monitor (as the when on a breakpoint the CPU is completely halted meaning no Serial negotiation can happen). Once it is connected you can then stop at the relevant lines of code.

I think here is nothing wrong with me.
But I'm still not able to watch Serial Monitor
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #7 - Apr 12th, 2023 at 11:47am
Print Post  
For the ESP-PROG COM port to work there need to be the wires between the RPi Pico Rx/Tx pins and the ESP-PROG Rx/Tx pins, which I expect are not wired up.

Does the serial monitor connect correctly if you have no breakpoints in your code at all?
  
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #8 - Apr 12th, 2023 at 12:20pm
Print Post  
Quote:
For the ESP-PROG COM port to work there need to be the wires between the RPi Pico Rx/Tx pins and the ESP-PROG Rx/Tx pins, which I expect are not wired up.

I double-checked my wiring between Pico Rx Tx and ESP-Prog. Everything looks ok.

Quote:
Does the serial monitor connect correctly if you have no breakpoints in your code at all?

No, it doesn't show any error but Serial Monitor is empty.
--
And I created new project and while I'm trying to debug, the debug screen coming up for old project. How can I fix that?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #9 - Apr 12th, 2023 at 12:41pm
Print Post  
ESP-PROG Serial Passthrough Wiring
If you are following the wiring diagram below, the Serial Lines are not connected in this image:
https://www.visualmicro.com/pics/RPiPico__DebugConnections_ESPPROG.png

If you wanted to connect this we can explain however it should not be needed.

Serial Monitor Output
Do you have the normal Serial.begin() and Serial.println() calls in your code at a baud rate matching the Serial Monitor Window?
Are DTR and RTS enabled at the bottom of the Serial Monitor Window? (they need to be ON)

Wrong Project Debugging
I assume the code for the new project has been compiled and uploaded to the board?
Are both projects in the same solution? (If yes then you will either need to change the Startup project by right clicking it in Solution Explorer, and clicking Set As Startup Project).

  
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #10 - Apr 12th, 2023 at 1:21pm
Print Post  
Quote:
If you are following the wiring diagram below, the Serial Lines are not connected in this image:

I followed this wiring diagram just for debug wiring. I connected Pico's RX and TX pins, which are pin11 and pin12, to the relative part of ESP-Prog (Attached Image).

Quote:
Do you have the normal Serial.begin() and Serial.println() calls in your code at a baud rate matching the Serial Monitor Window?
 
Yes.

Quote:
Are DTR and RTS enabled at the bottom of the Serial Monitor Window? (they need to be ON)

Yes.

Quote:
I assume the code for the new project has been compiled and uploaded to the board?
Are both projects in the same solution? (If yes then you will either need to change the Startup project by right clicking it in Solution Explorer, and clicking Set As Startup Project).
It works now, thanks.

Should I change the driver of Dual RS232-HS (Interface 1)? 
It's FTDIBUS (v2.12.24.0) for now.
« Last Edit: Apr 12th, 2023 at 1:35pm by omerziya »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #11 - Apr 12th, 2023 at 1:35pm
Print Post  
Thanks for the update and confirming you are using the passthrough wiring.

The normal Serial object in the RP2040 core is linked specifically to the SerialUSB interface.  I believe you need to alter your code to use the Serial1 object instead, to output via the UART0 pins, or Serial2 to output via the UART1 pins.
  
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #12 - Apr 12th, 2023 at 2:28pm
Print Post  
Yes, you are right. 
I followed this link and edited my code. 
Here is the new output of the Serial Monitor. Baud rate isn't wrong but the data, which on the monitor, is corrupted.

The data read from the serial monitor is the same in debug and normal running.
« Last Edit: Apr 12th, 2023 at 2:32pm by omerziya »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #13 - Apr 12th, 2023 at 2:39pm
Print Post  
Have you reconnected the Serial Monitor after changing the baud rate?
Does it match the baud rate configured in your code?
  
Back to top
 
IP Logged
 
omerziya
Junior Member
**
Offline


Posts: 18
Location: Turkey
Joined: Feb 28th, 2023
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #14 - Apr 12th, 2023 at 2:48pm
Print Post  
Quote:
Have you reconnected the Serial Monitor after changing the baud rate?

Yes, I reconnected. The result is same.

Quote:
Does it match the baud rate configured in your code?

Yes, it matches.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Raspberry Pi Pico Debug Problem with ESP32 Prog
Reply #15 - Apr 13th, 2023 at 3:26pm
Print Post  
Thanks for confirming.

Can you try viewing the Serial port in another applications' monitor to validate it is a vMicro issue (e.g. Arduino IDE)?

Also can you confirm which pins you have connected for UART1 Tx/Rx (should be GP8/GP9 or GP4/GP5 from their diagrams):
https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.htm...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint