EmbeddedRelated.com
Forums

Newbie: Cant write code to HC12

Started by florianschrbr January 21, 2005

Hello!

i'm new in this group and in hcs12 software development! i wrote an
"hello world" application.
Compiling work fine, but when i send the hello.s19
file to my MC9S12C32 the ICC tells:

TwinPEEKs Monitor V2.1 for ChipS12.C32
Copyright (C)1996-2003 by Oliver Thamm
mailto:
3E>S10E8000CF100016804887CE08008EC9
Unknown command (H for Help)!
3E>DCA
00C0 00 00 00 00 00 00 00 00 00 1A<00>0C 28 01 00 0A <............(.
.0>
00D0 00 00 00 00 00 00 00 00 04 00 00 20 00 00 00 00 <........... ..
..>
00E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <..............
..>
00F0 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 04 00 <..............
..>
3E>C0081

Unknown command (H for Help)!
3E>4B775EC027C00C0C60C7B00C34C
Unknown command (H for Help)!
3E>3B34B775FC0800270CE603C10A2661
Unknown command (H for Help)!
3E>80DA6
Unknown command (H for Help)!
3E>1
Unknown command (H for Help)!
3E>6ED18
Unknown command (H for Help)!
3E>C1ED9
Unknown command (H for Help)!
3E>4CCBD
Unknown command (H for Help)!
3E>3DD5
Unknown command (H for Help)!
3E>

My Chip is an MC9S12C32 and my selected target in ICC is: 9S12Dx32/
Ax32 / Cx32!

Can anyone help me?

Thanks
Florian





In your protocol i don't see the commands for erasing the flash
(command X) and starting the loading process (command l). I also
assume that you have not converted the Data with SRECCVT. When you
like to transfer a new program with the TwinPeeks Monitor you must do
the following steps:

===================================================================
1. Align the data to even adresses with SRECCVT (when you purchased
your processor board from elektronikladen the tool is on the
supplemental CD). The syntax is:
sreccvt -m 0x00000 0xfffff 32 -o <name_of_the_output_file>
<name_of_the_input_file>
--> you can do this step automatically with the compile process in
ICC. Simply make a Batchfile wich should look like this:

copy %1.s19 %1.sx
sreccvt -m 0x00000 0xfffff 32 -o %1.s19 %1.sx

Name the file alignS19.bat for instance and copy this file an the
SRECCVT Tool in your project directory. In ICC go to "Project"-
>"Options"->"Compiler" and insert the following to the "Execute
Command after Successful Build" field: "aligns19 %p". Now you can
compile the whole project and the binary is automatically aligned
after the build process.

===================================================================
2. Power up the HC12 Board
===================================================================
3. When TwinPeeks shows up enter the command X to delete all flash
contents.
===================================================================
4. After erasing the flash enter the l command to start the loading
process.
===================================================================
5. Start the file transfer in your terminal program (if you use
OCConsole simply press the Transfer Button and choose the right file.
6. According to your starting adress enter "G 8000" where the "8000"
is the starting adress of your program.
===================================================================

Hope that helps,
Greets Daniel

--- In , "florianschrbr" <florianschrbr@y...>
wrote:
>
> Hello!
>
> i'm new in this group and in hcs12 software development! i wrote an
> "hello world" application.
> Compiling work fine, but when i send the hello.s19
> file to my MC9S12C32 the ICC tells:
>
> TwinPEEKs Monitor V2.1 for ChipS12.C32

> Copyright (C)1996-2003 by Oliver Thamm

> mailto:mct@e...
> 3E>S10E8000CF100016804887CE08008EC9

> Unknown command (H for Help)!

> 3E>DCA

> 00C0 00 00 00 00 00 00 00 00 00 1A<00>0C 28 01 00 0A <............
(.
> .0>
> 00D0 00 00 00 00 00 00 00 00 04 00 00 20 00 00 00 00 <...........
..
> ..>
> 00E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <............
..
> ..>
> 00F0 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 04 00 <............
..
> ..>
> 3E>C0081

>
> Unknown command (H for Help)!

> 3E>4B775EC027C00C0C60C7B00C34C

> Unknown command (H for Help)!

> 3E>3B34B775FC0800270CE603C10A2661

> Unknown command (H for Help)!

> 3E>80DA6

> Unknown command (H for Help)!

> 3E>1

> Unknown command (H for Help)!

> 3E>6ED18

> Unknown command (H for Help)!

> 3E>C1ED9

> Unknown command (H for Help)!

> 3E>4CCBD

> Unknown command (H for Help)!

> 3E>3DD5

> Unknown command (H for Help)!

> 3E>
>
> My Chip is an MC9S12C32 and my selected target in ICC is: 9S12Dx32/
> Ax32 / Cx32!
>
> Can anyone help me?
>
> Thanks
> Florian





Hi daniel!

thanks fro your answer! i tryed all steps from your post, but now came
up an other error:

3E>x
Press Y to erase FLASH Y
3E>
3E>l
Loading...
*
Invalid S-Record!
3E>A001D0016073D3B34B775EC027C00C0C60C7B00C3B757301B82C3
Unknown command (H for Help)!
3E>10A2606CC000D1680611F00C480FB180D0300C7F0
Unknown command (H for Help)!
3E>51B9ECC00006C1E2016ED02E64087168061EC1ED7
Unknown command (H for Help)!
3E>D02E74026E4CC000A168061CC0001B757301B82B9
82B0 FF FF FF FF FF FF FF FF FF<FF>FF FF FF FF FF FF <..............
..>
82C0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF <..............
..>
82D0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF <..............
..>
82E0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF <..............
..>

your batchfile works also fine!
any idea?

thanks for your help!
florian --- In , "Daniel Winkler" <gluecklicherossi@y...
> wrote:
>
> In your protocol i don't see the commands for erasing the flash
> (command X) and starting the loading process (command l). I also
> assume that you have not converted the Data with SRECCVT. When you
> like to transfer a new program with the TwinPeeks Monitor you must
do
> the following steps:
>
> ===================================================================
> 1. Align the data to even adresses with SRECCVT (when you purchased
> your processor board from elektronikladen the tool is on the
> supplemental CD). The syntax is:
> sreccvt -m 0x00000 0xfffff 32 -o <name_of_the_output_file>
> <name_of_the_input_file>
> --> you can do this step automatically with the compile process in
> ICC. Simply make a Batchfile wich should look like this:
>
> copy %1.s19 %1.sx
> sreccvt -m 0x00000 0xfffff 32 -o %1.s19 %1.sx
>
> Name the file alignS19.bat for instance and copy this file an the
> SRECCVT Tool in your project directory. In ICC go to "Project"-
> >"Options"->"Compiler" and insert the following to the "Execute
> Command after Successful Build" field: "aligns19 %p". Now you can
> compile the whole project and the binary is automatically aligned
> after the build process.
>
> ===================================================================
> 2. Power up the HC12 Board
> ===================================================================
> 3. When TwinPeeks shows up enter the command X to delete all flash
> contents.
> ===================================================================
> 4. After erasing the flash enter the l command to start the loading
> process.
> ===================================================================
> 5. Start the file transfer in your terminal program (if you use
> OCConsole simply press the Transfer Button and choose the right
file.
> 6. According to your starting adress enter "G 8000" where the "8000"
> is the starting adress of your program.
> ===================================================================
>
> Hope that helps,
> Greets Daniel
>
> --- In , "florianschrbr" <florianschrbr@y...>
> wrote:
> >
> > Hello!
> >
> > i'm new in this group and in hcs12 software development! i wrote
an
> > "hello world" application.
> > Compiling work fine, but when i send the hello.s19
> > file to my MC9S12C32 the ICC tells:
> >
> > TwinPEEKs Monitor V2.1 for ChipS12.C32

>
> > Copyright (C)1996-2003 by Oliver Thamm

>
> > mailto:mct@e...
> > 3E>S10E8000CF100016804887CE08008EC9

>
> > Unknown command (H for Help)!

>
> > 3E>DCA

>
> > 00C0 00 00 00 00 00 00 00 00 00 1A<00>0C 28 01 00 0A <..........
..
> (.
> > .0>
> > 00D0 00 00 00 00 00 00 00 00 04 00 00 20 00 00 00 00 <..........
.
> ..
> > ..>
> > 00E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <..........
..
> ..
> > ..>
> > 00F0 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 04 00 <..........
..
> ..
> > ..>
> > 3E>C0081

>
> >
> > Unknown command (H for Help)!

>
> > 3E>4B775EC027C00C0C60C7B00C34C

>
> > Unknown command (H for Help)!

>
> > 3E>3B34B775FC0800270CE603C10A2661

>
> > Unknown command (H for Help)!

>
> > 3E>80DA6

>
> > Unknown command (H for Help)!

>
> > 3E>1

>
> > Unknown command (H for Help)!

>
> > 3E>6ED18

>
> > Unknown command (H for Help)!

>
> > 3E>C1ED9

>
> > Unknown command (H for Help)!

>
> > 3E>4CCBD

>
> > Unknown command (H for Help)!

>
> > 3E>3DD5

>
> > Unknown command (H for Help)!

>
> > 3E>
> >
> > My Chip is an MC9S12C32 and my selected target in ICC is:
9S12Dx32/
> > Ax32 / Cx32!
> >
> > Can anyone help me?
> >
> > Thanks
> > Florian





How exactly do you download your code to the hc12 ?

1. You start your monitor program
it finds the hc12 and twinpeeks ?
2 then you use the command L ?
to load a s.19 file ?
;->l
Loading...
******

3. you load s.19 as a text file ?
for you must load it as a text file
(I don't mean file-name.txt )
when you see those stars ******loading is succes.

4 start with g 0800 or with the number where your program starts in
memory
;->g 0800
Executing 0800..

Perhaps only this command 3E what you give is wrong
this is what I get
;->3e
Unknown command (H for Help)!
;->3E>
This is garbage!
;->3E>1
This is garbage!
;->

or are your typing in this whole s.19 file ?
;->3E>S10E8000CF100016804887CE08008EC9
This is garbage!

good luck ! Cyrill



Loading...
*
Invalid S-Record! I think your doing every thing fine you are only
loading it as a wrong file don't load it as a
binary file or what ever just as a text file

file-name.s19 load as text.

cyrill





hello cyrill!

thanks for help!

i use ICC12 and i have no idea how to send the hello.s19 file as text
file? can i set this in option?
is it possible to send the file with terminal-programm?

thanks
florian
>
> Loading...
> *
> Invalid S-Record! > I think your doing every thing fine you are only
> loading it as a wrong file don't load it as a
> binary file or what ever just as a text file
>
> file-name.s19 load as text.
>
> cyrill





hello

I haven't got the same version as you
and a other hc12 but I use a standard windows terminal
program to download mine file's
with this terminal program I have several options to download it
and when I try a other option It also doesn't work
But I see you get already 1 star *
so you'r close .



Now i got it - you use the terminal program thats build in in ICC12. I
never get the file transfer to work with this terminal programm. You
should use OCConsole. You can get it here:

http://elmicro.com/files/occonsole_v30.zip

With this program i never had any problems. Before it works you must
change the setting for the Handshake sequence to "#42". You find this
setting under the "File Transfer" Options.

Any other terminal program will surely also do it.

Greets Daniel.

--- In , "florianschrbr" <florianschrbr@y...>
wrote:
>
> hello cyrill!
>
> thanks for help!
>
> i use ICC12 and i have no idea how to send the hello.s19 file as
text
> file? can i set this in option?
> is it possible to send the file with terminal-programm?
>
> thanks
> florian
> >
> > Loading...
> > *
> > Invalid S-Record!
> >
> >
> > I think your doing every thing fine you are only
> > loading it as a wrong file don't load it as a
> > binary file or what ever just as a text file
> >
> > file-name.s19 load as text.
> >
> > cyrill




Can you sent me your File.s19

or show how it looks like you can open it with
notepad and copy paste it.and perhaps the code you are compiling http://www.seattlerobotics.org/encoder/jun99/dougl.html

tells something about the s record

The manual tells something about
The monitor is processing each S-Record line seperately. If the last
address of such an S-Record is even, the 2nd byte to form a complete
word is missing. TwinPEEKs will append an $FF byte in this case, so
it
is able to perform the word write.
The problem occurs, if the byte stream continues with the following
S-Record line.
To avoid this problem, it is necessary to align all S-Record data
before programming. This can be done using the freely available
Motorola Tool SRECCVT:
SRECCVT -m 0x00000 0xfffff 32 -o <outfile> <infile>
A detailed description of this tool is contained in the SRECCVT
Reference Guide (PDF).

SAME as
daniel winkler says .

You get one star * what means one line has been sent
Before loading into non-volatile memory (Flash EEPROM), this
kind of memory must always be erased. Also, only word writes can be
used in this case. It may be required to prepare S-Record data
accordingly,
before it can be downloaded (see instructions above).
The sending terminal program (such as OC-Console) must wait for
the acknowledge byte (*), before starting the transmission of another
line. This way, the transmission speed of both sides (PC and MCU) are
synchronized.

Try a other file

let me know if you have any succes
and don't give up !

Cyrill




Hello Cyrill, hello Daniel!

I downloaded the OC-Console and it works better, but there is always
an error!
Here is my .S19 file:
S1238000CF100016804887CE08008E080227056A000820F6CE80C1CD08008E80C12706
18FE
S12380200A307020F516802A20FECC001A16804D2006CC803B16808920F83D48656C6C
6FC1
S123804020576F726C640A001D0016073D3B34B775EC027C00C0C60C7B00C3B757301B
82C3
S12380603D3B34B775FC0800270CE603C10A2606CC000D1680611F00C480FB180D0300
C7F0
S1238080E60387B757301B823D3B34B7751B9ECC00006C1E2016ED02E64087168061EC
1ED7
S12380A0C300016C1EEC02C300016C02ED02E74026E4CC000A168061CC0001B757301B
82B9
S12380C03DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FF7E
S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
009B
S9030000FC

Thats an simple helloworld application from the example folder in
icc12!
After erasing my flash and downloading the file, following error
appears in OC-Console:
Write error at FFE0
3E>S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
F80009B
3E>

Have you any idea?

Thanks for the great help!
Florian
>
> Can you sent me your File.s19
>
> or show how it looks like you can open it with
> notepad and copy paste it.and perhaps the code you are compiling > http://www.seattlerobotics.org/encoder/jun99/dougl.html
>
> tells something about the s record
>
> The manual tells something about
> The monitor is processing each S-Record line seperately. If the last
> address of such an S-Record is even, the 2nd byte to form a complete
> word is missing. TwinPEEKs will append an $FF byte in this case, so
> it
> is able to perform the word write.
> The problem occurs, if the byte stream continues with the following
> S-Record line.
> To avoid this problem, it is necessary to align all S-Record data
> before programming. This can be done using the freely available
> Motorola Tool SRECCVT:
> SRECCVT -m 0x00000 0xfffff 32 -o <outfile> <infile>
> A detailed description of this tool is contained in the SRECCVT
> Reference Guide (PDF).
>
> SAME as
> daniel winkler says .
>
> You get one star * what means one line has been sent
> Before loading into non-volatile memory (Flash EEPROM), this
> kind of memory must always be erased. Also, only word writes can be
> used in this case. It may be required to prepare S-Record data
> accordingly,
> before it can be downloaded (see instructions above).
> The sending terminal program (such as OC-Console) must wait for
> the acknowledge byte (*), before starting the transmission of
another
> line. This way, the transmission speed of both sides (PC and MCU)
are
> synchronized.
>
> Try a other file
>
> let me know if you have any succes
> and don't give up !
>
> Cyrill