Author Topic: Locking up a K60 tower board  (Read 13504 times)

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Locking up a K60 tower board
« on: June 19, 2012, 03:01:31 PM »
Hi Mark,

We have just bought a couple of Tower systems with K60 processor boards, we were initially able to connect to the systems using Rowley crossworks and the built in OSJTAG port. After trying to flash uTasker we seem to have bricked both K60 processor boards. Neither can be detected by rowley any more.

I'm wondering if something in the setup has configured the cards to disable the JTAG ports?

Do you know if there is any recovery procedures available?

We have access to Rowley Crossworks and an eval copy of Keil with the uLink

Any help or thoughts gratefully recieved

Martin

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Locking up a K60 tower board
« Reply #1 on: June 19, 2012, 03:55:25 PM »
Hi Martin

The Kinetis can lock out JTAG depending on the Flash configuration setting (starting at Flash address 0x400), however this shoudln't be possible with uTasker/Rowely due to two reasons:
1) The setting is defined in kinetis.c

const KINETIS_FLASH_CONFIGURATION __attribute__((section(".f_config"))) __flash_config
= {
    KINETIS_FLASH_CONFIGURATION_BACKDOOR_KEY,
    KINETIS_FLASH_CONFIGURATION_PROGRAM_PROTECTION,
    KINETIS_FLASH_CONFIGURATION_SECURITY,
    KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION,
    KINETIS_FLASH_CONFIGURATION_EEPROM_PROT,
    KINETIS_FLASH_CONFIGURATION_DATAFLASH_PROT
};


to set values that are don't activate this. If you check in the binary file loaded (uTaskerV1_4.bin) you should find that the 16 byte form address 0x400 are
00 00 00 00 00 00 00 00 ff ff ff ff be 03 ff ff

2) Rowley Crossworks doesn't program code to this range - when dowloading you should have seen a warning that the loaded code didn't match that verified in Flash and, when a list of differences is generated, it shows that several bytes in this are are still at 0xff in Flash.



The JTAG pins are not used in the project and I haven't heard of anyone being able to lock out a debugger with them; I don't think that they suffer from the same lock out possibility that the Stellaris JTAG ports do.

There is some more info here about locking chips, including a link to Keil resources that supposedly can recover in some circumstances:
http://forums.freescale.com/t5/Kinetis-ARM-Cortex-M4/Secured-Kinetis-device/td-p/91305


However, I don't think that it is possible to lock a board with the project unless the Flash configuration were to be explicitly changed to do it and a different loader to the Rowley one used.

What message does Rowley give? Sometimes I find that I need to power cycle the board and restart Crossworks. Also, after installing MQX (to get an idea about the Wifi driver being used) I could no longer work with any P&E tools (including OSJTAG) without reinstalling the P&E drivers.

Regards

Mark

P.S. Try also CW10.2 (or maybe it is CW11 now) and try a mass erase using its inbuilt Flash loader tool.
Also try running the P&E Firmware Information Utility from their Formware Updater package to check that the drivers/OSJTAG are OK




Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: Locking up a K60 tower board
« Reply #2 on: June 19, 2012, 05:06:28 PM »
Hi Mark,

Thanks for the quick reply, after a lot of googling we managed to find a way to wipe the flash in the chip using the Demo version of the Keil compiler and the Keil uLink Jtag (needed some settings changing first though).

I have also been told by Rowley that you can do it through their tools as follows

You need to load the target script file into the script console.
>load("targets/Kinetis/Kinetis_Target.js")
>MassErase()
You'll need to updated OSJTAG to do this.
Regards
Michael


--- Additional comment from Rowley as yet untested
Clear the target property "Identify On Connect" - remember to enable it after that MassErase()

You will also need to have the Rowley specific OSJTAG firmware loaded too for this to work


Whilst delving into the Rowley documentation for the Kinetis CPU support package I came across a reference to updated firmware for the OSJTAG programmer see below

The package contains an update to the firmware that can be loaded on to the OSJTAG hardware of the TWR CPU modules. The updated firmware improves the download and debug performance of the CrossWorks 'Kinetis OSJTAG' target interface. You'll need to use the firmware update procedure available from PE micro and point the updater program at the supplied file osbdm-jm60_kinetis_rowley_101_0.s19. You can click on the above link to get a copy of the firmware into the editor and then right click on the editor tab and select 'Copy Full Path' to get the path to the filename of the firmware into the paste buffer.

Will update this posting with more info on Rowley when I get it
« Last Edit: June 29, 2012, 11:14:29 AM by mhoneywill »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Locking up a K60 tower board
« Reply #3 on: June 19, 2012, 08:46:13 PM »
Hi Martin

Good that you can recover the boards.

I have used the Rowley OSJTAG firmware and can confirm that it is much faster than the version delivered with the boards. It is also compatible so can still be used with all tools. To update you need the P&E Firmware updater which can be downloaded from the P&E homepage - quite a simple procedure and it guides you through the process.

Regards

Mark

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: Locking up a K60 tower board
« Reply #4 on: June 20, 2012, 02:00:25 PM »
Hi Mark,

Yes the Rowley upgrade to the OSJTAG does work faster, Its nice to know it will still work with other Tools too (thanks for that info). Is it any faster with the other tools in your experience?

The next weird thing I'm struggling with is whenever I plug in an SD card, I loose Ethernet connectivity, I've narrowed it down to the SDCARD WPswitch which goes into the processor pin PE27.

Even if I hold the processor in a reset state by pressing the reset switch, if I operate the SDCARD detect switch the ethernet lights will go out on the jack. All very weird unless there is a short on the PCB. The circuit diagrams show no connection to PE28 on the Ethernet board.

I've even tried downloading the binary image avaliable from the uTasker website http://www.utasker.com/Demos/Kinetis/uTaskerSerialBoot_V1.01.zip and still as soon as the SD card is plugged in the Ethernet lights go out. This fault occurs on both of our Kinesys K60 tower systems.

The joy's of working with a new chip / dev board

Cheers

Martin
« Last Edit: June 20, 2012, 03:28:17 PM by mhoneywill »

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: Locking up a K60 tower board
« Reply #5 on: June 20, 2012, 03:45:58 PM »
Have found the problem, The SDCARD WP pin is tied to PTB1 which is in turn tied to the RSTOUT line on the primary tower connector. This is in turn connected to the RESET line of the Ethernet chip.

What this means is that to use the SD card you have to either disconnect the WP switch (Best option), or set the WP switch so that the RSTOUT line is not pulled low when an SD card is present.
The best solution is to remove isolate the switch, as it will be operated as the SD card is inserted. Maybe this is a change with my revision of processor card, but its a real gotchya that should be mentioned somewhere
« Last Edit: June 25, 2012, 09:35:58 AM by mhoneywill »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Locking up a K60 tower board
« Reply #6 on: June 20, 2012, 08:19:57 PM »
Hi Martin

This is an unfortunate restriction on newer boards - it is discussed here: http://forums.freescale.com/t5/Kinetis-ARM-Cortex-M4/SDHC-driver-and-Flash-program-routines-for-Kinetis-K60N512/m-p/75497#M276

The boards that I have are older and so don't show this.

I think that the debugger with the Rowley FW is faster when used with any tools.

Regards

Mark

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: Locking up a K60 tower board
« Reply #7 on: June 21, 2012, 02:38:19 PM »
Yep I've got a REV D pcb with this unfortunate wiring issue, I think it would be a good idea to mention this in your PDF starters guide as I can imagine it catching a few people out, especially presuming new boards will all be RevD.

We either left the SD card in with its WP link set (And disabled WP detect code in uTasker) or put a piece of paper between the switch contacts (bit fiddly)

On another tack we're just tweaking the FTP server to work natively with windows explorer (In windows 7 at the moment, but will also test in XP), we'll post the code mods when we've finished.

Cheers

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Locking up a K60 tower board
« Reply #8 on: June 23, 2012, 11:14:09 AM »
Hi Martin

The Kinetis document has been updated to include a corresponding warning about the write protect switch on newer boards:
http://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis_demo.pdf

Regards

Mark