Skip to content

Commit

Permalink
V4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
felias-fogg committed Jan 16, 2025
1 parent 1669756 commit bca790c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 29 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog for dw-link

## Version 4.0.4
- Changes in platform.ini files
- Change: Giving a more informative error message when the stuck-at-1
error is diagnosed because of capacitive load on the reset line

## Version 4.0.3 (03-Jan-2025)

- ISP programming got a watch dog timer so that after a wrong choice the debugger will recover after 4 seconds
Expand Down
22 changes: 12 additions & 10 deletions docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,16 @@ Finally, there are commands that control the settings of the debugger and the MC
| monitor dwire [+\|-] | **+** activate debugWIRE; **-** disables debugWIRE; without any argument, it will report MCU type and whether debugWIRE is enabled (*) |
| monitor reset | resets the MCU (*) |
| monitor mcu [*mcu-name*] | If no argument is given, the MCU dw-link is connected to is printed. Otherwise, it is checked whether the given *mcu-name* matches the connected MCU and if not, a fatal error (5) is signaled. |
| monitor ckdiv [1\|8] | **1** unprograms the CKDIV8 fuse, **8** programs it; without an argument, the state of the fuse is reported (*) |
| monitor oscillator [r\|a\|x\|e\|s] | set clock source to **r**c osc., **a**lternate rc osc., **x**tal, **e**xternal osc., or **s**low osc. (128 kHz); without argument, it reports the fuse setting (*) |
| monitor breakpoint [h\|s] | set number of allowed breakpoints to 1, when **h**ardware breakpoint only, or 25, when also **s**oftware breakpoints are permitted; without argument it reports setting |
| monitor speed [l\|h] | set communication speed limit to **l**ow (=150kbps) or to **h**igh (=300kbps); without an argument, the current communication speed and limit is printed |
| monitor ckdiv [1\|8] | **1** unprograms the CKDIV8 fuse, **8** programs it; without an argument, the state of the fuse is reported (*+) |
| monitor oscillator [r\|a\|x\|e\|s] | set clock source to **r**c osc., **a**lternate rc osc., **x**tal, **e**xternal osc., or **s**low osc. (128 kHz); without argument, it reports the fuse setting (*+) |
| monitor breakpoint [h\|s] | set the number of allowed breakpoints to 1, when **h**ardware breakpoint only, or 25, when also **s**oftware breakpoints are permitted; without argument, it reports setting |
| monitor speed [l\|h] | set the communication speed limit to **l**ow (=150kbps) or to **h**igh (=300kbps); without an argument, the current communication speed and speed limit is printed |
| monitor singlestep [s\|u] | Sets single stepping to **s**afe (no interrupts) or **u**nsafe (interrupts can happen); without an argument, it reports the state |
| monitor lasterror | print error number of last fatal error |
| monitor flashcount | reports on how many flash-page write operation have taken place since start |
| monitor lasterror | print error number of the last fatal error |
| monitor flashcount | reports on how many flash-page write operations have taken place since the start |
| monitor timeouts | report number of timeouts (should be 0!) |

All of the commands marked with (*) reset the MCU.
All of the commands marked with (*) reset the MCU. The ones marked with (+) need to take the MCU out of the debugWIRE mode and afterwards in again.

<a name="section67"></a>

Expand Down Expand Up @@ -1068,8 +1068,9 @@ Error # | Meaning
2 | Connection error: MCU type is not supported
3 | Connection error: Lock bits or BOOTRST could not be cleared
4 | Connection error: MCU has PC with stuck-at-one bits
5 | MCU type does not match
6 | Unknown connection error
5 | Connection error: Reset line has a capacitive load
6 | MCU type does not match
7 | Unknown connection error
101 | No free slot in breakpoint table
102 | Packet length too large
103 | Wrong memory type
Expand Down Expand Up @@ -1197,7 +1198,7 @@ Initial version
* New fatal error: Wrong MCU type (caused by monitor mcu command)
* Renamed fatal error 3
* The *boards manager URLs* have changed: a suffix `_plus_Debug` has been added to the core name.
* Simplified paltoformIO.ini
* Simplified platoformio.ini
* Corrected statement about the meaning of BREAK when the debugger is not active
* `monitor mcu` command listed
* Description of how to use the AutoDW jumper added
Expand All @@ -1206,3 +1207,4 @@ Initial version
* Added notes that you cannot debug the UNO, but need to select ATmega328
* Added notes about the target board and potentially using external powering
* Edited the problem description for locked up hardware debugger/serial line
* New fatal error: capacitive load on the reset line
22 changes: 17 additions & 5 deletions dw-link/dw-link.ino
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@
#define CONNERR_UNSUPPORTED_MCU 2 // connection error: MCU not supported
#define CONNERR_LOCK_BITS 3 // connection error: lock bits are set
#define CONNERR_STUCKAT1_PC 4 // connection error: MCU has PC with stuck-at-one bits
#define CONNERR_WRONG_MCU 5 // wrong MCU (detected by monitor mcu command)
#define CONNERR_UNKNOWN 6 // unknown connection error
#define CONNERR_CAPACITIVE_LOAD 5 // connection error: Reset has a capacitive load
#define CONNERR_WRONG_MCU 6 // wrong MCU (detected by monitor mcu command)
#define CONNERR_UNKNOWN 7 // unknown connection error
#define NO_FREE_SLOT_FATAL 101 // no free slot in BP structure
#define PACKET_LEN_FATAL 102 // packet length too large
#define WRONG_MEM_FATAL 103 // wrong memory type
Expand Down Expand Up @@ -1099,11 +1100,21 @@ boolean gdbConnect(boolean verbose)
DEBLN(conncode);
if (conncode == 1) {
#if STUCKAT1PC
mcu.stuckat1byte = (DWgetWPc(false) & ~((mcu.flashsz>>1)-1))>>8;
//DEBPR(F("stuckat1byte=")); DEBLNF(mcu.stuckat1byte,HEX);
if (mcu.sig == 0x9205 || mcu.sig == 0x930A) {
mcu.stuckat1byte = (DWgetWPc(false) & ~((mcu.flashsz>>1)-1))>>8;
DEBPR(F("stuckat1byte=")); DEBLNF(mcu.stuckat1byte,HEX);
} else {
conncode = -5;
}
#else
mcu.stuckat1byte = 0;
if (DWgetWPc(false) > (mcu.flashsz>>1)) conncode = -4;
if (DWgetWPc(false) > (mcu.flashsz>>1)) {
if (mcu.sig == 0x9205 || mcu.sig == 0x930A) {
conncode = -4;
} else {
conncode = -5;
}
}
#endif
}
if (conncode == 1) {
Expand All @@ -1121,6 +1132,7 @@ boolean gdbConnect(boolean verbose)
case -2: gdbDebugMessagePSTR(PSTR("***Cannot connect: Unsupported MCU"),-1); break;
case -3: gdbDebugMessagePSTR(PSTR("***Cannot connect: Lock bits are set"),-1); break;
case -4: gdbDebugMessagePSTR(PSTR("***Cannot connect: PC with stuck-at-one bits"),-1); break;
case -5: gdbDebugMessagePSTR(PSTR("***Cannot connect: Reset line has a capacitive load"),-1); break;
default: gdbDebugMessagePSTR(PSTR("***Cannot connect for unknown reasons"),-1); conncode = -CONNERR_UNKNOWN; break;
}
if (verbose) {
Expand Down
32 changes: 18 additions & 14 deletions examples/pio-varblink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@
default_envs = debug

[env:debug]
extends = env:attiny85 ;; <--- substitute the right board here
extends = env:attiny85 ;; <--- substitute the right board here
build_type = debug
debug_tool = custom
;;debug_port = /dev/cu.usbmodem211101 ;; <-- specify instead of debug_server with correct serial line
debug_server = /usr/local/bin/dw-server.py
-p 3333 ;; <-- specify instead of debug_port
;;debug_port = /dev/cu.usbmodem01 ;; <-- specify instead of debug_server with correct serial line
debug_server = /usr/local/bin/dw-server.py ;; <-- specify instead of debug_port
-p 3333
debug_init_cmds =
define pio_reset_halt_target
monitor reset
end
set serial baud 115200
monitor reset
end
define pio_reset_run_target
monitor reset
continue
end
set serial baud 115200
target remote $DEBUG_PORT
monitor version
monitor mcu
$LOAD_CMDS
$INIT_BREAK
monitor version
monitor mcu
$LOAD_CMDS
$INIT_BREAK
debug_build_flags =
-Og
-g3
-fno-lto
-Og
-g3
-fno-lto

[env:attiny85]
platform = atmelavr
Expand Down

0 comments on commit bca790c

Please sign in to comment.