USBDM Cannot detect or program target

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USBDM Cannot detect or program target

10,027 次查看
Brittney412
Contributor I

Hello, I have been trying to troubleshoot getting the HCS12 Programmer to detect and program unsuccessfully. With everything I have tried, the result is the same- When I select the target chip and press Detect Chip, I just get a popup that says:

 

Programming Error

Failed to connect to target
Reason: General Fail (for compatibility)

 

The target chip is an MC9S12P and I am using a JS16. 

I started by trying to use the latest USBDM software on sourceforge (4.12.295) and drivers (tried 4.12.1 as well as 4.12.3). I am able to see the JS16 in the device manager window under Debugging Interface. I got this far on both a windows 7 machine and a windows 11 machine (both 64 bit windows), but they both show the same popup. I also tried switching to a different JS16 as well as a different circuit board with the target chip and always got the same. I have used the USBDM firmware updater and made sure the JS16 were up to date as well.

Further troubleshooting:

After doing the above, I tried each of the different versions of USBDM on sourceforge (4.10.5, 4.10.6, 4.11.1) and got more of the same. I first uninstalled the current USBDM version and driver, then tried installing a new one each time. Though with those older versions, the driver install didn't seem to work- the install wizard said it failed due to an error (didn't say what it was) and that it was incomplete/no changes were made. 

Some info:

I am doing this work to help someone out. Previously, he did have a working USBDM setup with these exact JS16s/circuit boards with this same target chip to program and then the windows 7 machine crashed and needed to be factory reset. After a reset/reinstall, now things are not working. We do not remember/know what USBDM version was running before.

Any help or insight would be greatly appreciated. I have seen a number of posts on similar subjects with either no resolution or a resolution with a link (and the link always appears to be dead or invalid).

Thank you.

 

0 项奖励
回复
7 回复数

9,947 次查看
Brittney412
Contributor I

Hello,

I did the two operations you described. I renamed the files to reflect what was done, attaching here for you. The mass erase failed, showing a similar failure message (general fail). I have tried this with two different ribbon cables; both could be bad, but that feels a little unlikely? 

I will be out of town for the next 10 days, but will try that earlier version when I return.

Thanks for the continued assistance.

0 项奖励
回复

9,957 次查看
Brittney412
Contributor I

Hello,

Thanks for the reply. I've attached the logs.

Thanks

0 项奖励
回复

9,945 次查看
pgo
Senior Contributor V
 

Hi

Sorry but the logs still show

DeviceInterface.deviceName => 1, 'MC9S12A32'

Could you do it yet again but close using the close button so changes persist

When re-opening check which device appears in the device selection to confirm this.

In the mean-time I'll have a closer look at the log provided.

Thanks

PS. I don't understand how this discussion board shows threads.  Could you make sure you reply to my reply as it's getting confusing!

PPS. Looking at the logs you have provided the BDM is failing a simple write to the target.  This should work even with the wrong target selected.  I really suspect a physical problem with the connection.

I have confirmed that selecting the wrong chip has no effect on the initial write so I can't really suggest much else other than doing physical tests on the hardware.  Do you have a multimeter or better an oscilloscope?  If so I can suggest some further physical tests to do to test the interface.  ( I note that you have tried different hardware so maybe not!)

bye

0 项奖励
回复

9,834 次查看
Brittney412
Contributor I

Hello, I retried the steps from earlier. Logs attached here. I do have access to a multimeter/oscilloscope for further testing.

0 项奖励
回复

9,812 次查看
pgo
Senior Contributor V

Hi Again,

Thanks for the logs, unfortunately I can't see anything really useful there.

It appears to be failing on the first write to the target after making a connection.  I can't think of a reason for that.

If you want to check waveforms I have attached a set of taken with a secured S12P128MQK which is effectively the same as the chip you are using.  It has the same reference manual and only differs in the amount of Flash memory.

To obtain these waveforms it is necessary to use UsbdmScript which is a TCL utility provided with the software.  The following commands are used (in order)

; Basic connection
settarget hcs12
; It will report BDMs found
openbdm
; To do the reset waveform
reset sh
; To do the remaining connect sequences - repeat as necessary
connect

 bye

PS. Significance of waveforms

1 - RESET/BGND sequence - This should put the chip in Background mode (which disables watchdog by default).

2 -  Overview of connect (sync followed by communication)

3 - SYNC part of connect sequence - this allows the target clock frequency to be determined.

4 - 1st byte of communication - just to confirm the BDM ACK pulse (9th pulse after 8 data pulses)

0 项奖励
回复

9,956 次查看
pgo
Senior Contributor V

Hi,

I have only had a quick look at the logs.

It is failing pretty much straight away in a TCL script where it is trying to disable the watchdog on the chip. 

I have looked at the script on GUTHUB and there were some relatively recent changes made but I can't see how they could affect the operation (they were print messages for debug).  If you want to try a version before these changes you can try USBDM V4_12_1_275 (May 2022) depending on your level of patience.

The chip appears to be secured (I think) which means that the BDM cannot fully connect to the target.  This is not fatal as it is still possible to mass erase the chip without a full connection.

I should have been more specific in my request - could you do the following sequence with the debug version of the programmer please (current version)?

  • Start the debug version of the programmer.
  • Manually set the target device correctly.
  • Exit the programmer (this just means the log will be shorter as the device doesn't need to be set.
  • Start the debug version of the programmer.
  • Do an immediate mass erase
  • Exit the programmer

This is a minimal sequence that should always work!

As a I indicated, I cannot find a 9S12P device for testing.  I am using a 9S12HY64 which is very similar (same style flash, COP and BDM interface) and it works OK. 

The only way I was able to get a similar error message was by disconnecting the target entirely.  I would advise checking the BDM cable as I have had the ribbon-cable with crimped connectors fail without any visible sign.

Thank you

 

0 项奖励
回复

9,996 次查看
pgo
Senior Contributor V

Hi,

I no longer have a MC9S12P chip to test with so it's a bit of a problem checking for chip-specific problems.

The error message is generic and just means it can't connect to the target.

It will be produced if there is no power or connection to the target.

There us usually a second dialogue with another message but it may vary I guess.

===========================================

Please do the following to aid in testing:

https://sourceforge.net/projects/usbdm/files/Version%204.12.1/Software

This is just so that it is consistent with the one I have installed in a VM for testing.

  • Run the debug version of the programmer usually located in

C:\Program Files\pgo\USBDM 4.12.1.320\

You will need to use the command (from the command line in above directory)

.\UsbdmFlashProgrammer-debug.exe -target=hcs12

  • Try the failing operation
  • Upload the log files located in %APPDATA%\usbdm
    • Flashprogrammer.log
    • usbdm.log

This may provide some information on what is going wrong.

bye

 

0 项奖励
回复