USB-MON08 - How I did it. - 9S08GT16A

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

USB-MON08 - How I did it. - 9S08GT16A

4,214 Views
jarin
Contributor I
Hi all.

This post is not EXACT way how to do it, because I still didn't draw properly schematics (I'm out of office now). But if you are experienced, you should be able to get the point and replicate my work or you should be inspired how to do it with other components (I used just parts from my junk box). Hope everybody interested will enjoy it.

I fell in love with HC08 chips a time ago, but after I found out my new laptop does not have any serial port and classical MON08 doesn't work with serial/USB adapters, I cooled down. For my home projects I really wouldn't spend a lot of money to buy some professional tool, so HC08 went into background. Here on forum are a few messages about developing and debugging with HC08 chips without "real" RS232 port or without a tool from P&E or other manufacturers (conclusing it's impossible - until now, read on).
I decided to try to find out what's actually happening and why RS232/serial converters doesn't work. In fact they work very good most of the time, until there comes to break signal. Break signal is very obscure thing, because for HC08 and HCS08 break signal is 10 or 11 bit long zero on line, but for other MCU's (like microchip MCU) or for example in LIN protocol, break is 13 bits long zero on line. I wasn't able to find ANYTHING about receiving or transmitting breaks in documentation of USB/serial conveters, but apparently that chips requring also 13 bit long break. When it comes to break in MON08 protocol, conveter just doesn't understand it as a break, and reports 0x00 or something else. This is of course bad. But this situation also clearly implies what to do with it. We just need to make breaks longer than 10 bits, all other bytes should be transparently send on.
So I did what I had to do. I took board with FT232BM and 9S08GT16A device (it's equipped with two SCI's, that is good for my task). Schematics (very very rough and incomplete) is here.

http://jednocipy.kvalitne.cz/usbmon08/usb_mon08.png

GT16A runs on 24MHz (12MHz bus) with 4MHz resonator. SCI1 is connected to FT232BM, SCI2 with two passives creates simple MON08 adaptor. This connects to target (in my case HC908JK8), IRQ pin is switched to 8,5V (there is mistake in schematics, voltage source should be 8,5V). Reset is switched to ground via pusbutton. JK8 runs with it's own oscillator, 7,3728MHz crystal, thus the MON08 speed is 7200baud.

Firmware in GT16A is quite simple and I created it in about 10 minutes. SCI waits for a character and if it's not a break, passes on other SCI, if it's a break, set lower baud rate and send 0x00 (0x00 at lower baud rate actually creates a break). Quite simply, isn't it?
Firmware is here.

http://jednocipy.kvalitne.cz/usbmon08/main.c

I would like to mention again, the project is very very alpha version, quick and dirty, but it really works. I can program and debug my good old JK8 with no RS232 port!
Schematics is incomplete (for example no capacitors at supply or with crystals etc...) but it will give you a rough picture, source code is very very simple and straightfoward with fixed baud rate (external switches would be nice to accomodate various baud rates for various targets). I also would add oscillator (7,3728MHz to 7200 baud or 9,83MHz for 9600 baud, but this will require slight changes in firmware) and Vtst source (probably MC34063 or something like that to create 8-9V from 5V USB). I don't have PCB for it. I reused PCB for GT16A, which is leftover from another project, other connections are made on piece of universal PCB.
As far it's just alpha version, but I gave it to community for inspiration. I'll probably work on it in my spare time, so no guarantee of developement speed.

Cheers,
Jarin



Message Edited by jarin on 2008-07-17 10:51 AM

 

Added p/n to subject.



Message Edited by NLFSJ on 2008-07-17 07:29 AM
Labels (1)
0 Kudos
5 Replies

744 Views
Jack8421
Contributor I

Ten years later and this became a problem for me while having a need to hack a 68HC908AB32 micro.

Even though this thread is long dead, my post might help someone else who ends up here.

I tried Jaromir's idea of extending the 'Break' length, but it didn't help at all. I used an Atmel micro bit banged in ASM.

I'm convinced that break length is not the problem at all. I tried varying it from the standard 11 bits up to milliseconds in length.

Good news though, I did find the solution !  After writing the Atmel code and wiring up the hardware and wasting shitloads of time, as you do when you're obsessed, I then discovered that all I needed to do was change the algorithm I was using. to the  high speed  '908_AB32_HighSpeed.08P' rather than the regular 908_AB32.08P. Problem solved !

This worked under both Windows XP SP3 32bit and Windows 7 64bit on two separate machines.

Prolific PL2303TA was the most reliable USB -serial converter. The FTDI  FT323R worked OK too, but only if 'Latency Timer' setting was changed from default 16ms to 1ms in both the above operating systems. I had no luck with CP2102 converter.

The only other hardware needed was 2 gates of a 74HC125 IC and 9.1v zener etc arrangement as per the 68HC908AB32 data sheet. So instead of the data sheet's MC145407 in the schematic, the PL2303TA is used instead.

When trying an RS232 com port using a MAX3232 instead of a USB-Serial converter, the high speed algorithm wouldn't work at all. It needed the regular 908_AB32.08P.

Software used by the way was PROG08SZ freebee from PEMicro.

I do have to ask myself: Why did PEMicro never offer this as a solution all those years ago when people were asking them for help ? The answer is clear. They didn't have a f.u.c.k.i.n.g.clue !  Typical low paid help desk employees and not an engineer in sight.

Hope this post helps someone in the future.  Cheers Jim

0 Kudos

744 Views
jarin
Contributor I
Added:
I tried the GT16A hardware with ultra cheap USB-RS232 converter with Prolific chip (apparaently PL2303) and it seems to work with JK8. I still didn't tried other targets.

Also I tried it under newest CodeWarrior 6.2. Previous tests I did under CW 3.1.

Jarin
0 Kudos

744 Views
peg
Senior Contributor IV
Hi Jarin,

Great work, I must admit I was thinking of something like this myself but have never got around to it as we have migrated most everything to S08 now.
One thing I don't quite get is that if the problem is that a break does not get produced by the USB converter properly then what do you actually get? Your code seems to imply that it outputs something like a break, so what is different between the one you get and the one you make?


0 Kudos

744 Views
jarin
Contributor I
Hi Peg,

yes, the problem is that USB-serial converters doesn't properly get break signals produced by HC08, because HC08 generates 10-bit long break signal, but converters apparently need longer break signal. So the difference between the one I get and the one I make is length. I get 10-bit break signal a I produce longer one, so that converter safely get it. I do this conversion from both sides, but from converter to HC08 should be enough. That's all, rest of communication is untouched.
0 Kudos

744 Views
donw
Contributor IV
The FTDI  FT323R  USB to rs232 convertor IC works OK handling the break character for Mono8
programming.  Some commercial USB dongles use the IC. I use one as supplied by
dontronics.co.au   part #N14327
Note also that you have to alter the 'packet idle time' in the USB setup from the default 16msec
to 1 msec.
0 Kudos