Where can I find the serial monitor software (.s19 or .sap) for MC9S08QE8 and MC9S08SH8?

cancel
Showing results for 
Search instead for 
Did you mean: 

Where can I find the serial monitor software (.s19 or .sap) for MC9S08QE8 and MC9S08SH8?

Jump to solution
1,417 Views
Contributor II

I want to program the HCS08s without using a debugger. I have a USB to UART converter, and a Cyclone programmer. From the reference manual, I gathered that S08s do not have the serial monitor on ROM. Where can I find the software files, so that I can flash the serial monitor and use the SCI to program it?

If there are any alternative procedures to program the HCS08 without the debugger, I would appreciate any suggestions.

1 Solution
210 Views
Senior Contributor II

Another bootloader (which does not require any specialized software on the PC side) can be found here:

http://aspisys.com/code/hc08/tboot.html

Written for this assembler: ASM8 HC08/9S08 Assembler wherein you will also find the bootloader source and required includes.

It supports QE32 and QE128, and it's trivial to add support for QE8 and SH8.

View solution in original post

14 Replies
211 Views
Senior Contributor II

Another bootloader (which does not require any specialized software on the PC side) can be found here:

http://aspisys.com/code/hc08/tboot.html

Written for this assembler: ASM8 HC08/9S08 Assembler wherein you will also find the bootloader source and required includes.

It supports QE32 and QE128, and it's trivial to add support for QE8 and SH8.

View solution in original post

210 Views
Contributor II

Hello Tony,

I am trying to find out how to use this assembler. Can you give me an example how to include files and specify their directories? I keep getting "0 files processed!".

I tried: 

>asm8 -S @C:\Programs\ASM8 Macro Assembler\code\tboot.asm -DQE32

0 Kudos
210 Views
Senior Contributor II

I updated the bootloader (http://aspisys.com/code/hc08/tboot.html ) to add both QE8 and SH8 cases.

I also added the respective include files (qe8.inc and sh8.inc) to ASM8 distribution (inside freeasm8.zip).

These cases haven't been tested, however, so some verification may be required before using.

Please download ASM8 HC08/9S08 Assembler once again to get all the updated files.

210 Views
Contributor II

The quotations fixed any issue with compilations. Thanks for the QE8 and SH8 compatibility, got the reply just as I started looking through your code. I managed to successfully program a QE8 with the cyclone. However, both hiwave.exe and an2295 can't detect the MCU. That being said, I can talk with it via serial:

TBoot v1.16 (c) 2018 ASPiSYS 16.777 MHz

[E]rase, [L]oad, [ESC]ape: Error
[E]rase, [L]oad, [ESC]ape: Error
[E]rase, [L]oad, [ESC]ape: Error
[E]rase, [L]oad, [ESC]ape: Error
[E]rase, [L]oad, [ESC]ape: Error

As you can see, entering E, L or ESC yields an error. I am guessing there is an issue with my transmission. I'll try to isolate the issue.

0 Kudos
210 Views
Senior Contributor II

Assuming there are no hardware issues/noise on your MCU side SCI RX line, I would check the following:

1. Is there any inversion on the MCU RX line by any chance?  If yes, then assemble with the extra option -dRXINV to set the RX line as inverted.  (This is the most likely problem the way it looks.)

2. What baud rate are you using?  (You can change it with -dBPS=rate for example -dBPS=38400) to one with 0% error (if any for the given frequency of operation).

3. If no bps rate gives 0% error, and although there are no visible errors on the TX (based on provided output) to suggest this may be the problem, the default bps choice has an error of 1.13% which could potentially create problems in combination with a non-ideal trim.

So, try assembling with -dHZ=38400*512 (or whatever other suitable value) which gives a zero error 38400 bps max rate.  This means you will also need to adjust the P&E algorithm accordingly (if you don't know how I can help).

Hope this helps.

210 Views
Contributor II

The issue was completely on the PC's side. I tried using a different communication terminal, and voila -- it understands everything I send. The manufacturer of the USB to UART converter recommended Tera Term, which worked fine enough, except it doesn't give the option to send hex. Downloaded and booted up RealTerm, and it sends any input through without incident. 

0 Kudos
210 Views
Senior Contributor II

Not sure I understand what the issue with the terminal program was.  You don't need any special terminal.

This bootloader understands plain ASCII commands, and you send your firmware as S19 (or S28 for MMU) format with simple copy paste (as if you actually typed the S19 file content by hand).

Anyway, did you get it to work, I mean to actually load your app correctly?

0 Kudos
210 Views
Contributor II

Unfortunately not. I am getting Address Range error. That being said, it does identify the memory addresses correctly with the '.' and final '!'. Here's a snippet of the loading operation, I did do [E]rase first. Also, please note that the BS character was replaced by a space in the comment.

LoadingS00E000051455F746573742E616273D8
S123E0008B899EFE05F6AF019EFF05888A81A7FCC6E0854C95E701C6E0844CF732E08620B0
S123E0201F898BF687E6024C9EE706E603EE018A4C20037FAF014BFB9E6B05F78A88AF045D
S123E0409E6B02DD9E6B01D932E088898BADB1974C9EE703ADAA4C9EE7044A260351001872
S123E060AD9E878AAD9A972005AD95F7AF019E6B04F79E6B03F320D5A7068145014094AD67
S123E0808DCCE0920000E08AE0A0000000000000000012019AB600A802B700C7180020F50F
S105E0A000007A
S105FFFEE07BA2
S9030000FC

. R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R. R R R R R R R
R R R R R R R R R R R R R R R R R R R R R R R R R. R R R R R R R R R R R R R R
R R R R R R R R R R R R R R R R R R. R R R R R R R R R R R R R R R R R R R R R R
R R R R R R R R R R. R R R R R R R R R R R R R R R R R R R R R R R R R R R R R
R R R. R R.!

[E]rase, [L]oad, [ESC]ape:

210 Views
Senior Contributor II

That's a simple problem.

TBoot by default allocates a page for user configuration.  This is controlled by the FLASH_DATA_SIZE constant.

You have placed your code in that area which is considered 'illegal'.  The idea is you want to protect your user's existing configuration when updating the app.  And if your data format changes, you can always have your app overwrite it with or convert it to a new one, if you like.

So, your options are:

1. Zero the size of the reserved-by-default configuration area by adding -dFLASH_DATA_SIZE to your assembly process (if you don't need any user configuration memory).

2. Move your application to start at $E200 (instead of $E000).

3. Add -dALLOW_EEPROM to your assembly process to enable erasing & programming of the reserved data flash used as simulated EEPROM. (Not recommended.)

If you also add the -exp option to asm8 you will get a file ending with .exp extension.  This file shows something like the following:

; Generated by ASM8 v9.75 Win32 [Thursday, February 15, 2018  6:55 pm]

bps_300             set       $0DA7,0
bps_1200            set       $0369,0
bps_2400            set       $01B4,0
bps_4800            set       $00DA,0
bps_9600            set       $006D,0
bps_19200           set       $0036,0
bps_38400           set       $001B,0
bps_57600           set       $0012,0
bps_115200          set       $0009,0
APP_CODE_START      set       $E200,0
APP_CODE_END        set       $FBFF,0
BOOTROM             set       $FC00,0
BOOTRAM_END         set       $0080,0
BOOTROM_VERSION     set       $0074,0
RVECTORS            set       $FBC0,0

As you can see APP_CODE_START and APP_CODE_END are the limits of your application memory.

If you zero the default flash set aside with -dFLASH_DATA_SIZE then you will get this for APP_CODE_xxx:

APP_CODE_START      set       $E000,0
APP_CODE_END        set       $FBFF,0

Your app (including the redirected vectors) should lie between these two addresses (inclusive).

The vectors can be defined in their default location or their redirected location (both will work).  If using the default locations, TBoot will manage them automatically and move them to end at the end at APP_CODE_END.

So, your actual app excluding the vectors should extend no more than one byte before the redirected vectors, see symbol RVECTORS.

Let me know if it worked.

210 Views
Contributor II

It works! After I assembled a new tboot with -dFLASH_DATA_SIZE and -exp, and flashed it on the QE8 -- this time, it replied with '.......!' and turned on the LED (after a power cycle). I was also happy that the bootloader was not functioning while the program was running, sending/receiving nothing on SCI. Yet, when I pulled down the RESET pin to ground, the program stopped and the bootloader was back in action -- allowing me to program it once more.

Many thanks for the help, Tony. Hope other people with the same question stumble onto this.

210 Views
Senior Contributor II

Glad it worked, and you're welcome.

A few more notes to keep this thread a bit more complete.

1. ESC resets, and if the conditions are right (i.e. no IRQ held low and some app seems to be loaded, i.e., the redirected reset vector points to within valid app range) it will run your app, otherwise, it will end up back in TBoot.

2. TBoot stays out of the way when your program runs, and unless I missed something by oversight, leaves all registers in their default state while not affecting any of the one-time writable registers.  This means except for taking up about 800 bytes of your ROM space (alright 1KB really due to Flash protection limitations), it is as if it does not exist.

3. You can keep the IRQ pin low while powering up to have it gain control again.  (This can be disabled with -dDISABLE_IRQ and rely on other method to update your app -- like 4 below -- but usually it's a good thing to have in case your app ever loses control.  As the IRQ pin is only checked during reset, and freed to default state afterwards it should not be a problem for most applications.)

4. You can have your app jump to TBoot directly (no need for hardware intervention to hold IRQ low), by the following method, shown in assembly language:

ldhx Vreset  ;(true reset vector at $FFFE)

cli          ;acts as flag to TBoot that this is software entry

jmp ,x        ;execute Monitor

0 Kudos
210 Views
Senior Contributor II

If your file path has spaces you need to quote the whole thing (this is for any program, not just asm8).

The default options should be OK.  So, try this:

asm8 "C:\Programs\ASM8 Macro Assembler\code\tboot.asm" -DQE32

Edit:

Regarding specifying include directories, it's really simple.  The default search order for relative path filenames is

1. current file path

2. main file path

3. root directory

Root directory is specified by the presence of a filename "_asm_" (without the quotes of course).

The default order and/or additional search paths can be specified with the -I option and then (optionally) saved in a asm8.cfg file.  But, I find the default order works the best for most cases.

210 Views
NXP TechSupport
NXP TechSupport

HI,

You want to program s08 flash via SCI, thus you need take use of SCI bootloader.

Please refer an2295

Developer’s Serial Bootloader. 


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

210 Views
Contributor II

Hello Jennie,

Thanks for the quick reply. I looked over the an2295, however I did not find any MCU slave software for the QE or SH, only for other HCS08s. I supposed I would have to modify one of those codes to work for the QE or SH. Is there a preferred assembler for the MCU slave code?

0 Kudos