MC9S12C64

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

MC9S12C64

1,953 Views
CyccPL
Contributor I

Hello comunity,

 

i bought a blank new MC9S12C64 mcu. My question is, what is the speed of internal oscylator, set in brand new mcu ??? Or [here secound question] where/how i can check this 

Labels (1)
0 Kudos
11 Replies

1,065 Views
kef
Specialist I

Do you mean you have no external crystal or oscilator connected? In this case MCU will operate at PLL self clock mode frequency. It is specified in S12C datasheet from min 1MHz to max 5.5MHz.

 

To determine bus clock frequency you can reset MCU to single chip mode (MODA, MODB, MODC all are pulled low at power up or reset). Bus clock frequency should be available then on ECLK pin. Bus clock frequency is a half of oscilator frequency.

0 Kudos

1,065 Views
CyccPL
Contributor I

thank for reply,

 

If i understand correct i must use a osciloscope to determine the oscilator freq, in solution described by you, i'm right ??

 

But what can i do without osciloscope ?? [dont have one] Is any software solution [ex. some command in CW] to get information about oscilator freq form MCU ??.

 

if MC9S12C64 have internal scilator, this is ONE freq oscilator ?? or it can be set for exemple 5MHz  ??

 

It internal oscilator is adjusable, how to set the freq oscilator ? via CW ??

 

i have TBML Debugger

 

 

""i know that in example for AVR microkontrollers there is a FUSEbit's witch i can modify via programmer, and this way chenge the internal speed oscilator to 1 or 4 or 8 MHZ {atmega8}

0 Kudos

1,065 Views
CyccPL
Contributor I

and one more quiestion:

 

i pass throught few datasheets about MC9S12C64 and have found 

"When secured, hardware commands are allowed to acces the register space in special single-chip-mode, if the flash and eeprom erase test fail"

When i try  debug the MCU i have Hi-WAVE errors after try MASS ERSE. So maby solution for my case is to get MCU to special-chip-mode, and then try debug, and erase/programm flash. BUT cant find in the PDF, with pins are MODA MODB MODC in 48LQFP..

 

Can some one please, draw for me a schematic how to simply wire the MC9S12C64 in 48LQFP package to get powered and this wirings allows me to programming the MCU. [witch pins +5V, witch pins GND, witch pins other necessary wirings to run debug]

 

 

0 Kudos

1,065 Views
kef
Specialist I

MODA and MODB are not available in 48-pins package, but they are pulled internally low, so you need to just pull MODC. But, debugger does it by default when in connects to the chip. It pulls MODC/BKGD low, then pulses reset low.

Flash program/erase is different when chip is secured. When unsecured, for best performance you load (debugger loads) small burning routine to RAM plus block of data to RAM, then debugger commands MCU to execute this code. In secured mode you can't command MCU via BDM to execute eny code. Instead of this, debugger has to setup flash clock register, set up FADDR and FDATA registers, write command register and frite FSTAT register to execute mass erase command. The same way writing directly flash module registers debugger should write 0xFE to NVSEC location in flash. I'm not sure if debuggers MASS ERASE command uses the right way to erase flash.

 

See attached picture. You may ignore PLL filter components C1,C2,R7 and not connect power leads to VDDA,VSSA,VRH

0 Kudos

1,065 Views
CyccPL
Contributor I

Thank you for schematic. have assembled board like on the piscture without PLL filter components C1,C2,R7 and not connect power leads to VDDA,VSSA,VRH

 

 

  • debugger has to setup flash clock register, set up FADDR and FDATA registers, write command register and frite FSTAT

 

how do that ??? Is for that some special menu in CW ?? i really dont thing i can program anything to the MCU becouse have errors every time when i try to do somtihing.. Some times error monit said that mayby the MCU is secured.. With one i dont understand. Becouse IF MODA and MODB are internally low, so when MODC is pull low by debugger MCU should go to special-chip-mode - like datasheets mentoined. So the flash security should be disabled/overpass

0 Kudos

1,065 Views
kef
Specialist I

How to do that? - When you create CW project, there should be some unsecurexxxx.cmd file in cmd subfolder. Unsecure.cmd for P&E connection looks like below. It contains write byte (wb) and write word (ww) to flash module registers. I don't know if it is the same for TBDML

reset
wb 0x03c 0x00  //disable cop
wait 20
wb 0x100 CLKDIV  // set FCLKDIV clock divider
wb 0x104 0xFF    // FPROT all protection disabled
wb 0x105 0x30    // clear PVIOL and ACCERR in FSTAT register
wb 0x102 0x00    // clear the WRALL bit in FTSTMOD

...

 

Special single chip mode is not the same like unsecure. To unsecure you need to mass erase the chip and programe 0xFE to NVSEC.

 

This thread mentions that there should be TBDML menu and Unsecure command. Did you try to run it? Maybe try searching TBDML forum

https://community.freescale.com/message/55293#55293

 

 

0 Kudos

1,065 Views
CyccPL
Contributor I

i found the "TBDML_Erase_unsecure_hcs12" in cmd sub folder it's look like that:

// ver 1.1 (7/7/04)// HCS12X Core erasing + unsecuring command file:// These commands mass erase the chip then program the security byte to 0xFE (unsecured state).// Evaluate the clock divider to set in ECLKDIV/FCLKDIV registers:DEFINEVALUEDLG "Information required to unsecure the device" "CLKDIV" 0x49 "To unsecure the device, the command script needs \nthe correct value for ECLKDIV/FCLKDIV onchip\nregisters.\nIf the bus frequency is less than 10 MHz, the value\nto store in ECLKDIV/FCLKDIV is equal to:\n \"bus frequency (kHz) / 175\"\n\nIf the bus frequency is higher than 10 MHz, the value\nto store in ECLKDIV/FCLKDIV is equal to:\n \" bus frequency (kHz) / 1400  + 64\"\n(+64 (0x40) is to set PRDIV8 flag)\n\nDatasheet proposed values:\n\nbus frequency\t\tE/FCLKDIV value (decimal)\n\n 16 \tMHz\t\t73\n  8 \tMHz\t\t39\n  4 \tMHz\t\t19\n  2 \tMHz\t\t9\n  1 \tMHz\t\t4\n"// An average programming clock of 175 kHz is chosen.// If the oscillator frequency is less than 10 MHz, the value to store// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 175 ".// If the oscillator frequency is higher than 10 MHz, the value to store// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 1400  + 0x40 (to set PRDIV8 flag)".// Datasheet proposed values://// oscillator frequency     ECLKDIV/FCLKDIV value (hexadecimal)// //  16 MHz              $49//   8 MHz              $27//   4 MHz              $13//   2 MHz               $9//   1 MHz               $4FLASH RELEASE   // do not interact with regular flash programming monitor//mass erase flashresetwb 0x03c 0x00  //disable copwait 20wb 0x100 CLKDIV  // set FCLKDIV clock dividerwb 0x104 0xFF    // FPROT all protection disabledwb 0x105 0x30    // clear PVIOL and ACCERR in FSTAT register wb 0x102 0x00    // clear the WRALL bit in FTSTMODwb 0x105 0x02wb 0x102 0x10    // set the WRALL bit in FTSTMOD to affect all blocksww 0x108 0xFFFEww 0x10A 0xFFFFwb 0x106 0x41    // write MASS ERASE command in FCMD registerwb 0x105 0x80    // clear CBEIF in FSTAT register to execute the command wait 20          // wait for command to complete//mass erase eepromwb 0x110 CLKDIV  // set ECLKDV clock divider wb 0x114 0xFF    // EPROT all protection disabledwb 0x115 0x30    // clear PVIOL and ACCERR in ESTAT register wb 0x112 0x00    // clear the WRALL bit in FTSTMODwb 0x115 0x02ww 0x118 0x0C00  // write to EADDR eeprom address registerww 0x11A 0x0000  // write to EDATA eeprom data registerwb 0x116 0x41    // write MASS ERASE command in ECMD registerwb 0x115 0x80    // clear CBEIF in ESTAT register to execute the commandwait 20          // wait for command to complete//reprogram Security byte to Unsecure stateresetwb 0x03c 0x00 //disable copwait 20wb 0x102 0x00    // clear the WRALL bit in FTSTMODwb 0x105 0x02wb 0x100 CLKDIV  // set FCLKDIV clock dividerwb 0x100 CLKDIV  // set FCLKDIV clock dividerwb 0x104 0xFF    // FPROT all protection disabledwb 0x105 0x30    // clear PVIOL and ACCERR in FSTAT register wb 0x102 0x00    // clear the WRALL bit in FTSTMODwb 0x105 0x02ww 0xFF0E 0xFFFE // write security byte to "Unsecured" statewb 0x106 0x20    // write MEMORY PROGRAM command in FCMD registerwb 0x105 0x80    // clear CBEIF in FSTAT register to execute the command wait 20          // wait for command to completeresetundef CLKDIV     // undefine variable 

 i create nwe project, press green arrow [ debug], then in menu type TBDML HCS12 - unsecure...

window ask me for clkDIV :

// If the oscillator frequency is less than 10 MHz, the value to store
// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 175 ".

// If the oscillator frequency is higher than 10 MHz, the value to store
// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 1400  + 0x40 (to set PRDIV8 flag)".

// Datasheet proposed values:
//
// oscillator frequency     ECLKDIV/FCLKDIV value (hexadecimal)
//
//  16 MHz              $49
//   8 MHz              $27
//   4 MHz              $13
//   2 MHz               $9
//   1 MHz               $4


i have external oscilator 8Mhz so should type 27 value i guess [i fact i tryed every numbers form 0 to 80, and every time has the same errors] klick OK.

 

process bar go up top 100% in about 15 sec. and after that i have error masage:

"Derivative could NOT be unsecured!!!!

The unsecure command file might be missing or disabled.

make sure the commabd file defined in the Unsecure panel of the command File dialog contains the correct commands to unsecure connected derivatice and the board oscillator frequency."

 

:smileysad: every time the same, can not programm, can not erase, even unsecure

 

mayby i can record shord vid, to show you my procedure ??maby i doing something wrong

 

 

0 Kudos

1,065 Views
kef
Specialist I

No idea. I hope you didn't connect VDD1 and/or VDDPLL to 5V.

Is your TBLDM really working? You need scope to investigate further.

0 Kudos

1,065 Views
CyccPL
Contributor I
  • I hope you didn't connect VDD1 and/or VDDPLL to 5V

no connection to 5V

 

  • Is your TBLDM really working?

really i dont have how to check this properly. Diodes are blinking, windows looks TBDML conneccted to USB port. CW the same. This looks like it's comunicate "somthing" with MCU but without control on it. put the values wherever he want's not to the specify locations.

i'm little dispapointed, spend over 130$ on this hardware. Bought this only for this one chip [very importatnt] and i can do nothing.

 

Dear kef, where are you from ?? If you have working xxBDM hardware mayby you wish help me ?? then email me cyccx@wp.pl

 

Regards

0 Kudos

1,065 Views
kef
Specialist I
  • If i understand correct i must use a osciloscope to determine the oscilator freq, in solution
  • described by you, i'm right ??

Yes, you should get an oscilloscope. You can't be productive without this essential tool, no matter do you work or are studying.

 

  • But what can i do without osciloscope ?? [dont have one] Is any software solution [ex.
  • some command in CW] to get information about oscilator freq form MCU ??.

If you had P&E Multilink, then in communications dialog (P&E HC(S)12 Connection Manager window) you could set BDM speed to Autodetect and connect. 2nd time you open connection dialog you will see communications speed reset to debugger calculated IO_DELAY_CNT. Oscilator frequency is roughly 240MHz / IO_DELAY_CNT. I'm not familiar with TBML

 

 

  • if MC9S12C64 have internal scilator, this is ONE freq oscilator ?? or it can be set for exemple 5MHz  ??

It is fixed and not adjusteable somewhere between 1 and 5.5MHz. You should use external clock or crystal with S12C. S12P family has internal trimmable oscilator.

0 Kudos