Can not write into QG8 memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can not write into QG8 memory

6,544 Views
admin
Specialist II
Hi guys,
I have updated my BDM firmware and now I think the BDM is communicating with the QG8 but I can not be 100% sure, so may be someone can point me onto the right track. Here is what happens after I press debug

a window with title "HCS08 Open Source BDM Setup"

click OK

then there is a window with title "No Communication"
"There is currebtly no communication with the hardware.
Please try to connect before loading an executable file."

click OK

go menu> "Component" / "Set Connection..."

then a window with title "Set Connection" comes up

Processor:  "HCS08"

Connection "HCS08 Open Source BDM"

click OK

A window comes up with title "HCS08 Open Source BDM Setup"

click OK

===================================
(Message on the command window)
Loading Target ...
TARGET SECURED?  NO TARGET CONNECTED?
TARGET SECURED?  NO TARGET CONNECTED?
No Link To Target
====================================

(Then I try again)

menu: component / set connection...

click ok

===============================================
(Message on the command window)
Loading Target ...
TARGET SECURED?  NO TARGET CONNECTED?
TARGET SECURED?  NO TARGET CONNECTED?
No Link To Target
Loading Target ...
executing .\cmd\HCS08_OpenSourceBDM_startup.cmd

!// At startup the commands written below will be executed
Startup command file correctly executed.
Target Ready
done .\cmd\HCS08_OpenSourceBDM_startup.cmd

Startup command file correctly executed.
===============================================

The red led then starts to blink


The problem I have right now is I can not write to registers or memory using BDC commands, also I can not load into the flash.

menu > "HCS08 Open Source BDM" -> "Flash"

then a  window pops up with tilte "Non Volatile Memory Control"
Message:
"Error while loading diagnostics algorith to target system.
The chip may be secured, or the derivative selected may be wrong."

click OK

difernt window with the same title "Non Volatile Memory Control"
MCU speed:    --.--- MHz
select .fpp file to load

click OK

windoew pops up with title
"FPP file file MCUID is different from the target MCUID."

click OK

(Then I try again)
menu > "HCS08 Open Source BDM" -> "Flash"

window pops up with title "Non Volatile Memory Control"
Message:
"Error while loading diagnostics algorith to target system.
The chip may be secured, or the derivative selected may be wrong."

=====================================================
Message on command window

FP: FLASH parameters loaded for MC9S08QG8_V11(NVMIF2 rev 3) from E:\code_warrior_5_1\prog\fpp\Mcu1019.fpp
=====================================================




From the data sheet

4.6 Security
The MC9S08QG8/4 includes circuitry to prevent unauthorized access to the contents of FLASH andRAM
memory. When security is engaged, FLASH and RAM are considered secure resources.
Direct-page registers, high-page registers, and the background debug controller are considered unsecured resources. Programs executing within secure memory have normal access to any MCU memory locations and resources. Attempts to access a secure memory location with a program executing from an unsecured memory space or through the background debug interface are blocked (writes are ignored and reads return all 0s).
..................................................        ....................          .....           .
..........     .......    ...  .   .

"The on-chip debug module cannot be enabled while the MCU is secure. The separate background debug
controller can still be used for background memory access commands, but the MCU cannot enter active
background mode except by holding BKGD/MS low at the rising edge of reset."

Does anyone know if this is a security issue that I can not write to the memory of the QG8 using commands such as

WB 0x0003 0xFF
WB 0x0002 0xFF

I have tried these 3 steps on the DATA sheet page 50

Security can always be disengaged through the background debug interface by taking these steps:

1. Disable any block protections by writing FPROT. FPROT can be written only with background
debug commands, not from application software.
2. Mass erase FLASH if necessary.
3. Blank check FLASH. Provided FLASH is completely erased, security is disengaged until the next
reset.
To avoid returning to secure mode after the next reset, program NVOPT so SEC01:smileyfrustrated:EC00 = 1:0.

But

WB 0x0003 0xFF
WB 0x0002 0xFF

does not shows up on the memory map and I can not change the value on the memory map.

Can anyone suggest I should do to test if anything is working correctly?

Thank you.

Tags (2)
0 Kudos
10 Replies

724 Views
peg
Senior Contributor IV
Hi again Learner,

I dusted off my home made OSBDM and my home made DEMOQG8.
I connected them up and fired up hiwave.exe from the prog directory under CW.
I had the difficulty as you did with it reporting it was secured.
This is an issue with the QG that it does not have a reset pin out of reset.
see this thread.
when this happens leave OSBDM powered,
turn off QG target, link BKGD pin to GND and power up target, remove link.
You have now forced it into bkgd mode.
tell OSBDM to connect, it should now.

On the demo board you have 2 pushbuttons at PTA2 and 3 and two leds at PTB6 and 7

Now if you push a button and point memory window so you can see address 0000 and then right click memory window and select update you can see the port A value change.

Also writing C0 to port b DDR (0003) and then C0 and 00 alternately to PTAD (0002)
you can turn on and off the two leds. These writes are reflected in the memory window directly as it is automatically refreshed after the write.

There you go it works!



Message Edited by peg on 2008-01-13 04:12 PM
0 Kudos

724 Views
admin
Specialist II
Hi Peg,
This is what I got after Set Connection in trying the method you suggested,



But I get this Unknown($1301) on the status bar of CW5.1, I still have problem with going into HSC08 Open Source BDM> Flash

I get this error message



After trying the procedure as described vs leaving the BKGD pin high when power up,
it seems to be doing the same thing. I do not know what I am doing wrong but 1 thing for certain is that it looks like CW5.1 can not recognize the MCUID, it shows that in

======================================
Non Volatile Memory Control window
Auto select according to MCUID :0x1301
======================================

and I when I try to load 0x1019 I get this error window
==========================================
||   FPP file loading warning
||   The FPP file MCUID is different from the target MCUID
==========================================

Is this because I have not entered the background debug mode?
Why does CW5.1 Auto select according to MCUID :0x1301 but not anything else?

The Command window seems to be working together with the Memory window eg. when I click onto the Memory window and change the value in an address I got this



Looks like random value at different address and when I scroll down the Memory window, the Command updates the Starting address of reading eg.

Reading From Memory Address: 0x0A03, count: 256
DiMemoryRead()==> DI_OK

Reading From Memory Address: 0x0B03, count: 256
DiMemoryRead()==> DI_OK

Is there an step by step troubleshooting procedure to varify what's working and whats not?

Totally lost on making this to work........ :smileysad:



Message Edited by Learner on 2008-01-14 06:28 PM
0 Kudos

724 Views
admin
Specialist II
Just want to report back, I followed the DEMO9S08QG8_SCH_C.pdf and added a pull-up resistor to the BKGD pin and now I am able to read and write to the memory, registors, have tested with turn on and off LEDs on Port B.

The steps are

1. Ground BKGD pin with pull up resistor
2. Click on Debug in IDE
3. HCS08 Open Source BDM Setup window opens
4. Power off and on QG8, unground BKGD pin and connect to pin 1 of BDM port
5. click OK on the HCS08 Open Source BDM Setup window
6. Debugger loads cmd files......e.g (HCS08_OpenSourceBDM_Erase_Unsecure.cmd)
7. Error message
 
8.Source window loads and display main.dbg file
9. WB 0x2..0x3 0xFF
10. Able to turn on/off LEDs on Port B

I think the debugger is communicating to the QG8 to some extent but not fully functional, I still get this Unknown($1301)



Does anyone know what ILLEGAL_BP means?

When I click on HCS08 Open Source BDM -> Flash

I get this



then this



then this



So I can not load into Flash still....

any ideas?
0 Kudos

724 Views
peg
Senior Contributor IV
Hi Learner,

Glad to see you are getting somewhere.
The lack of a pullup on BKGD does seem to be more of an issue with the QG than other S08's
The ILLEGAL_BP seems to be a very common symptom for when the BDM communications is not working properly.
This I believe goes back to what I said before about the simplistic error handling employed here.

0 Kudos

724 Views
admin
Specialist II
Hi Peg,
Would you suggest to include the pull up resistor when programming any HCS08 chips?

I used this file posted by RockyRoad to update the firm ware and used the

OpenSourceBDM_gdi.dll
OpenSourceBDM.dll
OpenSourceBDM.s19

from the zip

http://forums.freescale.com/freescale/board/message?board.id=OSBDM08&thread.id=2

I am currently using CW6.1 instead of CW5.1 with patch, I was getting the same error result without the pull up resistor do you think it would be worth a try going back using CW5.1 with the patch?

Higher up the thread you mentioned your OSBDM is working, is it fully functional ? Are you using the same zip file posted by RockyRoad? Currently it seems that I am the only one having this particular problem, if anyone else is using the identical zip file and everything is fully functional, then I can rule out the files are the cause of the problem and try to look some where else........

If you are using a different file, do you mind suggesting the link where you got the file from?

Also about the libusb.lib file, do I need to do anything with this file?

Thank you for your help!

regards,
 


0 Kudos

724 Views
peg
Senior Contributor IV
Hi Learner,

As mentioned elsewhere, I have programmed and debugged 100's of GT16 and GT16A processors with a P&E USB Multilink and NO onboard BKGD pullup. However, others, most notably forum user irob, has had difficulty without using one. So it is probably prudent to at least allow a location for a pullup on board. My homemade DEMOQG8 has a pullup because the original has one.

My OSBDM works fully functionally. It is a little tempermental on occasions and requires a few "kicks in the guts" to get it to connect properly. It is however very poorly constructed on 0.1" stripboard that is further slit into 0.05" stripboard with a knife. Whipped up on a rainy Sunday over a year ago. This also means that I have mostly used patched CW 5.1 to connect to it or GDI method manually. It is, as far as I know, running the latest version of everything that is clearly available here. I think you will find everything to be a least about 1 year old as there appears to be no further development in this time.

I don't have CW 6.1 installed yet as I don't usually use CW. I do have CW 6.0 installed which came with my DEMOQE128 board. If I get time I might try my home made DEMOQG8 on my home made OSBDM with CW6.0 just to let you know if it works for me.

0 Kudos

724 Views
peg
Senior Contributor IV
Hi again Learner,

I just loaded DEMO9S08QG8_APP.mcp into my fairly fresh install of CW6.0.
Changed the connection with the little IC icon to QG8 and OSBDM.
Then hit the green bug.
Failed to connect.
After using connect under the OSBDM menu about 6 times and manually holding BKGD low while cycling power to the QG8, I got a connection.
Quit hiwave.
Hit the bug again.
Got connection immediately.
Want to mass erase? Yes.
bingo all done!
hit run, All OK! All works!

Sorry this must be frustrating for you, but I can't find any problem.

As far as I can tell the latest source files that are in the firmware I am using is 24 Feb 2006 (3 of this date others are older) and the last time I compiled the OSBDM firmware was 14 Apr 2006 so there is nothing any later than this in my firmware.



Message Edited by peg on 2008-01-30 10:01 PM
0 Kudos

724 Views
admin
Specialist II
Hi Peg,
Do you think you can email me the exact same files to try? e.g.
OpenSourceBDM_gdi.dll
OpenSourceBDM.dll
OpenSourceBDM.s19

I think if I can try a set of files with the same edition CW known to work correctly, this would pretty much decide if it might be the BDM hardware that is the problem. I have pretty much traced the BDM and it seems to match whats on the  Open_Source_BDM_Interface_User_Manual.pdf , so at the mement I am suspecting that its the files that I have that's not working properly.

If loading your files still doesn't work, I think I would have to buy a BDM with a proper tech support!

0 Kudos

724 Views
peg
Senior Contributor IV
Hi Learner,

I can't be sure this is what I am actually using, but this is probably it.
Note that my CW6.0 installation is "out of the box"



Message Edited by peg on 2008-01-31 07:31 AM

 

opensourcebdm_abs1_s19.zip

opensourcebdm_dll.zip

osbdm_gdi_s08_v3_dll.zip

Message Edited by t.dowe on 2009-10-26 05:09 PM
0 Kudos

724 Views
admin
Specialist II
Hi Peg,
I finally got things working but this is my second debugger that combines OSBDM and TBDML, I have tested 4 drivers(OpenSourceBDM.dll) 1 from OSBDM zip, 2 drivers came with each of my BDM and yours.

Your driver seems to be working the best, I can read and write plus load into flash! I think its fully functional but I am still getting this ILLEGAL_BP message




The driver came with the OSBDM/TBDML works the same with same ILLEGAL_BP message shown above, however its very hard to connect to the target device.....

Thank you so much for your help!!! I owe you at least a few drinks! :smileyhappy:


0 Kudos