Since there isn't a dedicated subforum for LPCScrypt, I'm posting here.
The script dfu_boot included in the package fails with dfu-util 0.10.
There is a bug in checking dfu-util version. What, presumably, was a check for version 0.1, checks only the first three characters. Depending on this check, different VID:PID formatting is (in this case incorrectly) used. This makes the script fail at find the correct device in the output of dfu-util -l.
Most likely this check can be dealt away with in it's entirety, since version 0.5 is dated at 2012. As seen here 0.1 did indeed use different formatting.
Below is a quick patch (which works for me) removing that test and the used variable entirely.
My version of dfu-util is 0.10, the current Manjaro community package.
--- dfu_boot.bak 2021-04-12 19:44:12.055974951 +0200
+++ dfu_boot 2021-04-12 20:00:45.602209668 +0200
@@ -128,11 +128,6 @@
}
$LOGGING && echo "Using dfu-util version $dfu_ver at `which $DFU_UTIL`"
-# establish what kind of prefix VID:PIDs have when listed in -l
-vp_hex=
-[ "${dfu_ver::3}" = "0.1" ] && vp_hex="0x"
-# echo "DFU version $dfu_ver means we should use hex prefix '$vp_hex'"
-
if [ "_$DEVICE_VID_PID" != "_${DEVICE_VID_PID/:}" ]; then
# we have specified VID and PID in this argument
DEVICE_PID="${DEVICE_VID_PID//*:}"
@@ -164,7 +159,7 @@
fi
DEVICE_VID="${DEVICE_VID/0x}"
DEVICE_PID="${DEVICE_PID/0x}"
-DEVICE_VID_PID="${vp_hex}$DEVICE_VID:${vp_hex}$DEVICE_PID"
+DEVICE_VID_PID="$DEVICE_VID:$DEVICE_PID"
#DEVICE_VID_PID="\(0x\|\)$DEVICE_VID:\(0x\|\)$DEVICE_PID"
echo "Looking for DFU devices with VID $DEVICE_VID PID $DEVICE_PID ..."
Hj jdj,
To check your issue, please answer me below questions:
1. Which version of LPCScrypt do you work with? Please make sure you use the latest LPCScrypt v2.1.2 which can be downloaded from this url
2. Do you use NXP demo board? if yes, which one? If your own PCB, which part do you use?
3. steps of how to reproduce your issue?
Thanks,
Jun Zhang
I encountered this same problem with LPCScrypt 2.1.2 and dfu-util 0.11. LPCScrypt on Windows, since it includes its own dfu-util, is fine, but on Linux I had trouble flashing the Link2 probe on my LPCXpresso51U68. I just commented out the line in dfu_boot that sets vp_hex to '0x'. Equivalent sed command:
sudo sed -i 's/\[ \"\${dfu_ver/#[ "\${dfu_ver/' /usr/local/lpcscrypt/scripts/dfu_boot
I think rather than querying the version and deciding how to parse vid/pid, it would be better to query the vid/pid itself.
Thanks for the sharing.