Hi PGO,
A few months ago, I needed to debug MC9S08PB16, which was not supported on USBDM. We use Luciano's USBDM.
I changed some files and created a new HCS08-PBxx-Flash Program. These files and sources are attached. The Codewarrior worked pretty well with these patches on USBDM, and it allowed me to build a new firmware for one new product.
However, last week, production started, and USBDMs were not able to program the flash of most production Microcontrollers except for a few.
I attached the error logs, along with some oscilloscope images of BKGD (yellow) and BKGD/SWDIO_DRV USBDM internal (Blue).
Even more, for some unknown reason, we got a Sawtooth wave a couple of times. I cannot tell if they have a correlation with the programming issue. It can be seen in the Sawtooth.jpg.
I will be grateful for any help you could, and feel free to ask for further data.
Best,
Ricardo Trevisan
Did the behaviour change with the firmware update?
I would have expected the firmware change to fix the loss of connection after the software reset.
Please post the entire log if it is still not working.
Hi,
I have received some sample devices and done some initial tests but have not yet looked at actual programming the flash (apart from Mass erase).
As expected, it is not possible to reliably program these devices if they are blank. A mass erased device will enter a reset loop from power-up that interferes with connecting using the SYNC sequence. Refer Initial Connect Image.
It is necessary to hold BKGD low while powering on the device to obtain a reliable connection. As explained in Section 27.1.1 Forcing active background of the PB16 manual.
If you do the above, it is then possible to mass erase and temporarily disable security on the device using the ERASE_VERIFY flash command. This only persists until the next reset. The last point is important as if the watchdog is still active then the device will be secured again after a short while. It is necessary to disable the watchdog before doing the mass erase. This is possible even on a secured device.
Anyway I will have a look at the programming shortly.
Attached is the HCS08-PBxx-flash-scripts.tcl I have been using with UsbdmScript for initial testing.
Hi,
I have uploaded a new version with support for MC9S08PB16.
https://sourceforge.net/projects/usbdm/files/Version%204.12.1/Software/
Files have also been updated on GITHUB.
This version will still have the problem that the initial connection may need power to be cycled while BKGD is help. The programmer will prompt the user to do this.
There is no solution to this problem unless the BDM has the ability to control the target power.
bye
Hi Ricardo,
I have not looked at this in detail so just a quick response:
9S08 devices can only be programmed if the target can be forced into active background mode.
There are several ways of doing this:
Note that holding BKGD pin low during other resets may not result in active background mode on many later chips. I suspect this was a design choice motivated by reliability in target applications where the BKGD pin may have been used for the application and so could not be guaranteed to be high during reset. In addition the RESET pin may itself be re-purposed.
Unfortunately, on some devices only the 1st method will work reliably. This is for several reasons:
If either of the above is true, then the USBDM module may not have time to apply the second method between resets. If the programming software can detect this it may prompt the user to manually cycle Vdd while the BDM will hold BKGD low.
So, unless the actual USBDM programmer you are using supports target power control it cannot be reliably used for production programming (without human intervention).
The sawtooth pattern (I presume on reset pin) would indicate that this is the problem.
I don't think I have PB chip to play with so I unsure what I can do to investigate but I will check through the information you have provided to see if it indicates anything else.
Some thing to try (mainly to diagnose rather than solve):
If the above works the reason if likely confirmed to be as described.
bye
Hi pgo,
Thank you very much for your time.
I guess the issue is driven by other reason. Take a look at summary:
1- I changed the flash code to fit PB. I suppose I did it correctly once I debugged the firmware for weeks.
2- The correct connection was assured once every single time we did a "detect chip" and "mass erase" both successfully.
3- Some chips didn't accept the program, and others did.
4- The chip that refuses to be programmed will fail 99.9% of tries, not 100%.
5- Some chips can be programmed 100% of tries at that same chip.
6—The same USBDM can program all chips (100%) using the Codewarrior to flash the same S19.
Maybe this info could help to solve the issue.
The best,
Ricardo
Hi Ricardo,
Did you read my second reply - AFAIKS you have not disable the COP in the TCL scripts? In theory it should be sufficient to do so in the programming code but as was done for PT chips. For other chips the COP was disabled in TCL. There may be some reason for this but I can't recall it. I suggest you add code to do so.
The programming of chips in Codewarrior (depends on version) uses it own algorithms so may not be relevant.
There are a few things that look strange:
At the moment I can't see how to progress this without a chip to test.
I will see if NXP will supply a sample.
bye
Hi pgo,
Thank you for your time and tips.
I changed the flash program and TCL to disable WDog instead of refreshing it (attached).
I got no success.
Once some batch of PB micro allow to flash and others batch doesn't, I ask to kindly send your address to my email ric.eedh.br@gmail.com, so I can send you bad samples.
Best regards,
Ricardo
Hi pgo,
I would like to add some information that I believe will lead you to a solution.
I told some MC9S08PB16 can be flashed, others don't.
I got a not-worked on and warmed it, and then it worked too.
Please take a look on attached spreadsheet that I compare the cold and hot logs, and marked on yellow, some differences I guess will help.
Also attached the full logs and others files.
I hope it can help.
Best,
Ricardo
Hi,
I have received some sample chips from NXP and will be able to play with these in a few days.
I'm sorry I've been a bit busy lately.
I will PM an address if you want to send some samples that "reliably" fail.
bye
HI pgo,
I really appreciated your time.
Unfortunately, the issue was not eliminated at all, but it is stable now on the same error: "Target SYNC timeout" that occur on Mass Erase or Program Flash.
Attached we have the Log files.
If it helps the chip marking is: PB16 - MMTJ - XANKA
Best regards,
Ricado
Hi,
It appears to be losing the connection after a software reset to special mode.
Have you updated the BDM firmware?
bye
Hi PGO,
We got all firmwares updated by USBDM_4_12_1_330.
Still, we cannot program the flash.
The error message is: "Readback of the flash contents does not agree with buffer".
We can program the same device using USBDM by the Codewarrior software.
Please let me know if I can send more data.
Best regards,
Ricardo
The log you posted (a couple of posts above) shows firmware version
/* 0.00 */ USBDM_ErrorCode USBDM_Open(unsigned char):
BDM S/W version = 4.12.1, H/W version (from BDM) = 2.17
ICP S/W version = 2.6, H/W version (from ICP) = 2.17
The version packaged with the latest installer is 4.12.2.
You can check the version on the Interface tab of the programmer.
If this doesn't show 4.12.2 please use the USBDM Firmware Updater to update to the current version.
If it is up-to-date please post a current log.
Thanks.
Hi PGO,
Please take a look on attached log.
Below is the versions:
/* 0.01 */ USBDM_ErrorCode USBDM_Open(unsigned char):
BDM S/W version = 4.12.2, H/W version (from BDM) = 2.17
ICP S/W version = 2.6, H/W version (from ICP) = 2.17
Thank you.
Best.