EmbeddedRelated.com
Forums

HCS12 microcontroller question

Started by panfilero February 9, 2007

Yuriy K. wrote:

>> However I don't know of any specific problems of hyperterm. If all >> that you need is a basic terminal, it will work as good as any other >> program. > > > Can not receive 0x00 byte.
Why would you need a terminal for anything other then the text i/o ? Something like "parameter = 12345, press 1 to select this, press 2 to dump the memory"
> Hanging up from time to time, especially if you start it when data is > already flowing.
Driver problem?
> Inability to control RTS and DTR. >
Who is using RTS/CTS and DTR/DSR, please raise your hand. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
what luck, i can't believe you have the same board as me.  i changed
my code, so that i can recieve and transmit through SCI0..... I loaded
up a serial I/O device driver from http://users.ece.utexas.edu/
~valvano/ and changed it around a bit, since it was for a
MC9S12C32....

Am I correct to think that our board/MCU has a M-Clock speed = 25
MHz ?

I used 25 MHz and plugged it into the formula M-Clock/(16*BaudRate) I
used a baud rate of 9600, and got br = 163, and set this value in my
SCI0BDL register.... I then enabled my TE and RE bits.

is this the right way to initialize my serial port?

I then made this function:

void SCI_OutChar(unsigned char data){
  while((SCI0SR1 & SCI0SR1_TDRE_MASK) == 0){};
  SCI0DRL = data;

and called it like this:  SCI_OutChar('a');

i then make it and debug it on codewarrior, and then close the debug
screen, open hyperterminal, connect to COM1 with default settings....
and when i hit the "reset" button on my board..... gibberish pops up
on the screen.... like a "|" symbol.... i went and chenged the baud
rate in my MCU and different gibberish popped up..... does this mean
I'm not figuring my baud rate correctly?

thanks
joshua

In article <fbkAh.76132$qO4.39497@newssvr13.news.prodigy.net>, Vladimir 
Vassilevsky says...
> > > Yuriy K. wrote: > > >> However I don't know of any specific problems of hyperterm. If all > >> that you need is a basic terminal, it will work as good as any other > >> program. > > > > > > Can not receive 0x00 byte. > > Why would you need a terminal for anything other then the text i/o ? > Something like "parameter = 12345, press 1 to select this, press 2 to > dump the memory"
Checking what a serial port on a device is actually doing perhaps? Not all data is printable ASCII. IME experience hyperterminal reacts badly to the unexpected.
> > > > Hanging up from time to time, especially if you start it when data is > > already flowing. > > Driver problem?
I've seen it on multiple machines all with standard serial ports. Worse it can leave the serial port inaccessible.
> > > Inability to control RTS and DTR. > > > > Who is using RTS/CTS and DTR/DSR, please raise your hand.
Hand duly raised. I have walked novices through hyperterminal on the phone. Not a pleasant experience. And any engineering, service and manufacturing personnel I've worked with have had an easier time with terminal programs other than hyperterminal which seems designed more to confuse than to help. Robert -- Posted via a free Usenet account from http://www.teranews.com
Jerry Avins wrote:

> Vladimir Vassilevsky wrote: >> >> >> Tim Wescott wrote: >> >>> panfilero wrote: >>> >>>> I'm pretty new to microcontrollers, how do I short the serial and get >>>> it to echo? >> >> 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
I have scant tolerance for persons buying UP development boards without a clue as how to use or connect them. This is not a poor student. This is more likely some hack coder getting in way deeper than 'es skills. -- JosephKK Gegen dummheit kampfen die Gotter Selbst, vergebens.&nbsp;&nbsp; --Schiller
joseph2k wrote:
> Jerry Avins wrote: > >> Vladimir Vassilevsky wrote: >>> >>> Tim Wescott wrote: >>> >>>> panfilero wrote: >>>> >>>>> I'm pretty new to microcontrollers, how do I short the serial and get >>>>> it to echo? >>> 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 > > I have scant tolerance for persons buying UP development boards without a > clue as how to use or connect them. This is not a poor student. This is > more likely some hack coder getting in way deeper than 'es skills.
I did a few seat-of-the-pants digital processing jobs dealing with sampled data with good success, but decided to learn what I might have done better after I retired. I bought a DSK, got enlightened by some of the examples, came to comp.dsp to ask about some of the underlying theory, learned that I already knew much of it (Fourier transforms, convolution, etc.). My expertise with analog circuits, discrete digital logic, and embedded microprocessor systems saved me from asking all of the naive questions we see here, but I still remember an early radio project, when I thought that insulated wire was "insulted" wire. Nevertheless, my first crystal set was finished in time to listen to the World Series. Getting in deeper than my skills has always been a step toward expanding my skills. Give the guy a break. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
On Feb 13, 6:10 pm, "panfilero" <panfil...@gmail.com> wrote:
> what luck, i can't believe you have the same board as me.
No really suprising as Freescale elected to sell it also as the official full development platform. If you bought it from freescale, you got a CD of example code...
> I changed > my code, so that i can recieve and transmit through SCI0.....
I was recommending you use SCI1/B since the debugger halfway owns SCI0/ A - most likely to be an issue if you try to do interrupt based receiving. But that's probably not your problem at the moment.
> Am I correct to think that our board/MCU has a M-Clock speed = 25 > MHz ?
Yes, but are you enabling the clock multiplier? I'm not sure which the serial is physically derived from, so that could be an issue.
> I used 25 MHz and plugged it into the formula M-Clock/(16*BaudRate) I > used a baud rate of 9600, and got br = 163, and set this value in my > SCI0BDL register.... I then enabled my TE and RE bits.
My tables appear to use 163 for 9600 baud
> void SCI_OutChar(unsigned char data){ > while((SCI0SR1 & SCI0SR1_TDRE_MASK) == 0){}; > SCI0DRL = data;
Looks right, if your mask is 0x80 Did you set SCI0CR1 to 0x00 and SCI0CR2 to 0x0C ?
> gibberish pops up > on the screen.... like a "|" symbol.... i went and chenged the baud > rate in my MCU and different gibberish popped up..... does this mean > I'm not figuring my baud rate correctly?
Probably, or somebody's set at a different number of data or stops bits than the other
Vladimir Vassilevsky wrote:
> > > Yuriy K. wrote: > >>> However I don't know of any specific problems of hyperterm. If all >>> that you need is a basic terminal, it will work as good as any other >>> program. >> >> >> Can not receive 0x00 byte. > > Why would you need a terminal for anything other then the text i/o ? > Something like "parameter = 12345, press 1 to select this, press 2 to > dump the memory"
Because I do. Monitoring exchange between CPU and 3rd party device, for example.
>> Hanging up from time to time, especially if you start it when data is >> already flowing. > > Driver problem?
Standard COM port. Native WinXP-SP2 drivers. History does not work well either.
>> Inability to control RTS and DTR. >> > > Who is using RTS/CTS and DTR/DSR, please raise your hand.
Well, let's see. Slow text exchange, no timing whatsoever, no binary transfer, 3-wire interface only, no history, occasional hang-up, occasional locking serial port, ... Yes, of course it can be used... -- WBR, Yuriy. "Liberalism is a mental disorder"
> I have scant tolerance for persons buying UP development boards without a > clue as how to use or connect them. This is not a poor student. This is > more likely some hack coder getting in way deeper than 'es skills.
you know, I really appreciate everyones help and these message boards. Then you have people like JosephKK who say stuff like "I have scant tolerance for persons buying UP development boards without a clue as how to use or connect them". I think that's an ignorant remark, I mean, UP dev boards are similar to the old crystal radio sets of years ago, these days, when someone is curious to start learning about electronics they can go out and buy a dev board in a very similar way as years ago your curiosity would've led you to a crystal radio kit, and most of us would've bought something like this without knowing anything about it and gone in there and tinkered with it until we figured it out. Today, we also have the help of the internet and sush a huge amount of resources to help our curiosity, so along with the kits being more complicated today, there is also a huge amount of info out there to help you figure it out, it balances it all out. Anyway, I just thought this was a rather ignorant comment by JospehKK. I ended up finding the answer to my original post the problem was in the baud rate, here's the solution: I was using 25 MHz as my M-Clock frequency, but that is the board clock, the M-Clock = Bus Clock = 1/2 Board Clock so.... M-Clock = BUSCloc = OscClock / 2 SCI0BDL = M-Clock/(16*BaudRate) SCI0BDL = 12500000/(16*9600) = 81 much thanks to all the people who help out and share knowledge with others on here Joshua
panfilero wrote:
> >> I have scant tolerance for persons buying UP development boards >> without a clue as how to use or connect them. This is not a >> poor student. This is more likely some hack coder getting in >> way deeper than 'es skills. > > you know, I really appreciate everyones help and these message > boards. Then you have people like JosephKK who say stuff like > "I have scant tolerance for persons buying UP development boards > without a clue as how to use or connect them". I think that's
... snip ... You have to learn several things on Usenet. One is to have a thick skin. Another is to detect whom to ignore. Then there is netiquette, which you seem to have acquired, apart from preserving attribution lines for material you quote. Those are the initial lines that say "Joe wrote:". -- <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
On Mon, 12 Feb 2007 04:58:53 +0000, Michael A. Terrell wrote:
> Jerry Avins wrote: >> Jerry Avins wrote: >> >> > What old ad said, "Ask the man who owns one"? ... >> >> I remember now: Packard cars. How sexist! > > It went over real well, didn't it? The last I heard of Packard, they > made connector housings and wiring harnesses for other GM brands.
Didn't they get together with Hewlett and start making crappy scopes? ;-) Cheers! Rich