Maker Pro
Maker Pro

HCS12 microcontroller question

P

panfilero

Jan 1, 1970
0
Hello, I just got a MC9S12NE64 microcontoller and a development board,
and I've been trying to access my microcontroller through the
hyperterminal on my computer but have been having a really hard time.
I couldn't find any serial port driver files for this MCU, but had
some for a MC9S12C32 which i tried to modify to use with my MCU... my
code compiles on codewarrior and loads into my MCU but.... I can't get
it to show anything on the hyperterminal.... I was wondering if anyone
could tell me what steps I need to take to do this serial
communication with my MCU, or if anyone knows of any good resources or
websites where i could find driver files for this? My ultimate goal
is to control a programmable power supply through the serial port of
my MCU, so I'm trying to get familiar with the serial port by
accessing it through a hyperterminal....

any help or suggestions would be greatly appresicated,
thank you
Joshua
 
J

Jerry Avins

Jan 1, 1970
0
panfilero said:
Hello, I just got a MC9S12NE64 microcontoller and a development board,
and I've been trying to access my microcontroller through the
hyperterminal on my computer but have been having a really hard time.
I couldn't find any serial port driver files for this MCU, but had
some for a MC9S12C32 which i tried to modify to use with my MCU... my
code compiles on codewarrior and loads into my MCU but.... I can't get
it to show anything on the hyperterminal.... I was wondering if anyone
could tell me what steps I need to take to do this serial
communication with my MCU, or if anyone knows of any good resources or
websites where i could find driver files for this? My ultimate goal
is to control a programmable power supply through the serial port of
my MCU, so I'm trying to get familiar with the serial port by
accessing it through a hyperterminal....

There is more than one development board for that processor. I don't
remember if the SCI can be used as a UART, but the processor has plenty
of oomph to do bit banging. Are there no hints or code examples in the
accompanying literature?

Look for a configuration register. That might point you in the right
direction. There has to be some way to start the thing up.

Jerry
 
S

SFC

Jan 1, 1970
0
First check the serial cable. Do you get an echo when pins 2&3 are shorted?

SFC
 
S

SFC

Jan 1, 1970
0
panfilero said:
Hello, I just got a MC9S12NE64 microcontoller and a development board,
and I've been trying to access my microcontroller through the
hyperterminal on my computer but have been having a really hard time.
I couldn't find any serial port driver files for this MCU, but had
some for a MC9S12C32 which i tried to modify to use with my MCU... my
code compiles on codewarrior and loads into my MCU but.... I can't get
it to show anything on the hyperterminal.... I was wondering if anyone
could tell me what steps I need to take to do this serial
communication with my MCU, or if anyone knows of any good resources or
websites where i could find driver files for this? My ultimate goal
is to control a programmable power supply through the serial port of
my MCU, so I'm trying to get familiar with the serial port by
accessing it through a hyperterminal....

any help or suggestions would be greatly appresicated,
thank you
Joshua
 
T

Tim Wescott

Jan 1, 1970
0
panfilero said:
Hello, I just got a MC9S12NE64 microcontoller and a development board,
and I've been trying to access my microcontroller through the
hyperterminal on my computer but have been having a really hard time.
I couldn't find any serial port driver files for this MCU, but had
some for a MC9S12C32 which i tried to modify to use with my MCU... my
code compiles on codewarrior and loads into my MCU but.... I can't get
it to show anything on the hyperterminal.... I was wondering if anyone
could tell me what steps I need to take to do this serial
communication with my MCU, or if anyone knows of any good resources or
websites where i could find driver files for this? My ultimate goal
is to control a programmable power supply through the serial port of
my MCU, so I'm trying to get familiar with the serial port by
accessing it through a hyperterminal....

any help or suggestions would be greatly appresicated,
thank you
Joshua
Generally there aren't good drivers for the little embedded processors
like this -- the ones that you get from the chip manufacturers are
written by kids fresh out of school who have little practical
experience. If they're useful at all they're good to learn how the
peripheral works, but they're not good for a driver that you can
integrate into a larger application.

So what to do?

Check your cable, as SFC has suggested.

Check the voltages coming out of the board to make sure they're RS-232
compliant.

Assuming your cable is good, look through the driver that you have, and
your chip manual, CAREFULLY. Peripherals on microprocessors have gotten
very flexible, which means that they're very complex to program. Most
of them have what I like to call "screw the processor bits" -- there
will be at least one bit in a seemingly unrelated register that you have
to set to make things work. These magic bits are often found in the
on-board timer section (to get a clock to your peripheral), or the
pin-driver section (to get the signals out), or the CPU interrupt
section (to get an interrupt out to the CPU).

Were I having trouble with this sort of thing I would first try to get
the thing to send out test characters, one by one, without even thinking
of using interrupts. I'd hook the thing up to a terminal program, sure,
but I'd also hook it up to a scope, logic analyzer, or logic probe to
make sure that the output was at least wiggling. A scope is very useful
here, because in one swoop it tells you that the voltages are OK or not,
that the pins are wiggling or not, and that the baud rate is correct or not.

Once I had it working in transmit then I would address receive and
interrupts. (Note that normally I just dive in to trying to get it
working interrupts and all, but I often have to backtrack).

Good luck -- serial comms is generally something that has you tearing
your hair out for a while, then suddenly starts working. If you're
lucky, it'll even start working correctly. Generally once you do get it
working it'll work forever, though.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
 
P

panfilero

Jan 1, 1970
0
I'm pretty new to microcontrollers, how do I short the serial and get
it to echo? The development board I got is the: CME-12NE64-DEV
here's a link to it: http://www.axman.com/?q=node/257
it has 2 serial ports, i thought i would connect them both to them
computer in order to communicate with my chip through the
hyperterminal..... I got some code from this guy's web site: http://
users.ece.utexas.edu/~valvano/index.html
and tried to modify it a bit to work with my MCU, and I get it to
compile and run... but can't get anything to happen on the
hyperterminal..... I'm wondering if I have to fonfigure the other
serial port somehow, maybe it's not outputting.... If I set serial
port 1 on codewarrior to load my MCU with the program, I was thinking
I could plug the other serial port into com 2 on my computer and have
hyperterminal set up on com 2, to recieve and transfer data.... I
don't know if I'm thinking about this correctly.

thanks
Joshua
 
J

Jamie

Jan 1, 1970
0
panfilero said:
I'm pretty new to microcontrollers, how do I short the serial and get
it to echo? The development board I got is the: CME-12NE64-DEV
here's a link to it: http://www.axman.com/?q=node/257
it has 2 serial ports, i thought i would connect them both to them
computer in order to communicate with my chip through the
hyperterminal..... I got some code from this guy's web site: http://
users.ece.utexas.edu/~valvano/index.html
and tried to modify it a bit to work with my MCU, and I get it to
compile and run... but can't get anything to happen on the
hyperterminal..... I'm wondering if I have to fonfigure the other
serial port somehow, maybe it's not outputting.... If I set serial
port 1 on codewarrior to load my MCU with the program, I was thinking
I could plug the other serial port into com 2 on my computer and have
hyperterminal set up on com 2, to recieve and transfer data.... I
don't know if I'm thinking about this correctly.

thanks
Joshua
RX pin goes to TX pin.., that should do it.
 
T

Tim Wescott

Jan 1, 1970
0
panfilero said:
I'm pretty new to microcontrollers, how do I short the serial and get
it to echo? The development board I got is the: CME-12NE64-DEV
here's a link to it: http://www.axman.com/?q=node/257
it has 2 serial ports, i thought i would connect them both to them
computer in order to communicate with my chip through the
hyperterminal..... I got some code from this guy's web site: http://
users.ece.utexas.edu/~valvano/index.html
and tried to modify it a bit to work with my MCU, and I get it to
compile and run... but can't get anything to happen on the
hyperterminal..... I'm wondering if I have to fonfigure the other
serial port somehow, maybe it's not outputting.... If I set serial
port 1 on codewarrior to load my MCU with the program, I was thinking
I could plug the other serial port into com 2 on my computer and have
hyperterminal set up on com 2, to recieve and transfer data.... I
don't know if I'm thinking about this correctly.

thanks
Joshua
Pins 2 and 3 are the transmit and receive pins. If you short them
together, and the cable is working, then the computer will be talking to
itself.

It's a good test to make sure that everything up to the board is in
working order -- if there's something wrong on the host side any work
you do on the target board side is wasted effort.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
 
V

Vladimir Vassilevsky

Jan 1, 1970
0
Another embedded engineer needs his diapers changed...
Pins 2 and 3 are the transmit and receive pins. If you short them
together, and the cable is working, then the computer will be talking to
itself.

It's a good test to make sure that everything up to the board is in
working order -- if there's something wrong on the host side any work
you do on the target board side is wasted effort.

And don't forget to connect it to the power...

Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
 
C

CBFalconer

Jan 1, 1970
0
Tim said:
.... snip ...

Pins 2 and 3 are the transmit and receive pins. If you short
them together, and the cable is working, then the computer will
be talking to itself.

It's a good test to make sure that everything up to the board is
in working order -- if there's something wrong on the host side
any work you do on the target board side is wasted effort.

He may also have to jump the appropriate supervisory signals,
depending on the software configuration, such as RTS to DTR, etc.
A properly wired single connector is handy.

Excessive cross post cut back in follow-ups.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 
J

Jerry Avins

Jan 1, 1970
0
Tim said:
Pins 2 and 3 are the transmit and receive pins. If you short them
together, and the cable is working, then the computer will be talking to
itself.

It's a good test to make sure that everything up to the board is in
working order -- if there's something wrong on the host side any work
you do on the target board side is wasted effort.

You short the same two pins on the terminal side to make it loop back.
If both board and terminal work separately but they don't work together,
first make sure the baud rates are the same, then that the "common"
ground is really common.

Jerry
 
J

Jerry Avins

Jan 1, 1970
0
Vladimir said:
Another embedded engineer needs his diapers changed...

Give the guy a break. I use my breakout box, but I'll wager he doesn't
have one. Did he say he was an engineer? He's trying to get started.
That you and I did that before we got to high school may confer bragging
rights, but not sneering rights.

Jerry
 
T

Tim Wescott

Jan 1, 1970
0
Jerry said:
You short the same two pins on the terminal side to make it loop back.
If both board and terminal work separately but they don't work together,
first make sure the baud rates are the same, then that the "common"
ground is really common.

Jerry

I remember a case where the "common" ground had a 50V difference between
conductors. We discovered this _after_ we found the burnt place where
the serial port card's ground trace used to be.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
 
S

Spehro Pefhany

Jan 1, 1970
0
I remember a case where the "common" ground had a 50V difference between
conductors. We discovered this _after_ we found the burnt place where
the serial port card's ground trace used to be.

LOL. I remember the time we discovered the dufus^H^H^H^H customer had
swapped the ground and hot wires in the line cord. Surprisingly, the
test PC serial port survived.


Best regards,
Spehro Pefhany
 
J

Jerry Avins

Jan 1, 1970
0
Spehro said:
LOL. I remember the time we discovered the dufus^H^H^H^H customer had
swapped the ground and hot wires in the line cord. Surprisingly, the
test PC serial port survived.

I'm glad the dufus^H^H^H^H customer survived. I remember when one phase
of the 220V line got connected to the 5V bus on a small mainframe
computer. (Small meant that it filled only one room.)

Jerry
 
C

CBFalconer

Jan 1, 1970
0
Jerry said:
I'm glad the dufus^H^H^H^H customer survived. I remember when one
phase of the 220V line got connected to the 5V bus on a small
mainframe computer. (Small meant that it filled only one room.)

Over 40 years ago we lost a wall to wall breadboard (something like
6 full benches of wires, transistors, resistors, caps, and diodes)
to a frayed soldering iron cord. Plastic transistors literally
exploded. It took about two months to recover. You can see the
end result at:

<http://cbfalconer.home.att.net/firstpc/>

Follow-ups set to remove excessive cross-posting.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 
I'm pretty new to microcontrollers, how do I short the serial and get
it to echo? The development board I got is the: CME-12NE64-DEV

Okay, I have the same board on my desk.
If I set serial
port 1 on codewarrior to load my MCU with the program, I was thinking
I could plug the other serial port into com 2 on my computer and have
hyperterminal set up on com 2, to recieve and transfer data.... I
don't know if I'm thinking about this correctly.

Well, two things to keep in mind. One is that when you use the serial
monitor instead of a BDM pod, you loose SCIA. So make sure you code
is talking to the registers for SCIB.

The second thing is that your board can do some funky IR serial
comms. There's a dip switch near the second serial port, and you need
to have that set appropriately so that you have the serial level
shifter hooked up to the MCU and not the IR thingy instead/also. I
will never admit how much time I wasted trying to figure out where
those extra characters were coming from!

Last piece of advice: do yourself a favor and spring for a USB BDM
pod. It's relatively cheap (less than half the cost of your eval
board) and gives you full access to the chip, and both serial ports.

In terms of testing, I would recommend you try to get the NE64 sending
at the PC first. Stick a good old LED between the TXD and ground and
see that it's doing something (then halt your processor and see that
it stops). The do the same thing for the PC - see that the led
flashes when you hold down keys in the terminal program. Once they
are both talking, you can see about pursuading them to listen - the
NE64 receive fifo is only one deep so your probably want interrupts
(my interrupt routine just copies the characters into a software fifo
for dealing with later at leisure)
 
W

werty

Jan 1, 1970
0
We are scared of being electrocuted ,
so we put boxes around everything
then hook box to the "nuetral" AC .
Then we isolate the output power
supply from the AC mains , but there
is so much coupling , scopes dont work .

All for fear , for "safety" .

The box is supposed to allow a
path for current to open a ckt breaker ,
instead of that wire making contact
with humans .
It just makes jobs for gov't types .

Now that high powered CPU's
and color LCD's are low cost ,
its a good time to trash some old
obsolete software , like M$ and Linux
and C++ .
I now have 15 ARM cpu's in various
boxes , like GP2X and NDS-Lite
gameboxs .
I will hack to install a piece of code
that coexists for a while , then pushes
out the orig OpSys .
I will not use any of the popular
methods , no C, no assemblers ,
Its much faster and less agravating,
cause i dont have to study anyones
obtuse source code text .

In several KB , i will have a non-text
GUI dis-assembler .
Track-ball and a low res LCD ....

Hacking is fun ..
 
Top