can not write to SCI1D to perform SCI

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

can not write to SCI1D to perform SCI

Jump to solution
2,055 Views
farhud
Contributor III

For some reason I can not write anything to SCI1D. Here is what I am doing:

 

1. Configure the Baud rate to 19200.

2. Configure SCI1C1, SCI1C2. 

3. Enable SCI

2. Enable Transmitter

3. Clear SCI Transmitter Empty Bit

4. Write Data to SCI1D

 

I can see that my ISR is being. I can also see all of this happening by monitoring the appropriate memory addresses in CW EXCEPT memory address 0xFFFF803F which is the SCI1D. Nothing is written into it. It's been bugging for a day now. Would it be a clocking problem?  Does anyone have any suggestions?

Labels (1)
0 Kudos
Reply
1 Solution
1,165 Views
TomE
Specialist II

Hyperterm is fussy and usually wants some of the other RTS/CTS/DTR/Whatever signals set. The DE9 serial port connector has 9 pins. You're using three. The other six are there to cause 2^6=64 varieties of trouble.

 

Make sure you've got "Hardware Handshake OFF" in Hyperterm, and use a scope (or even a LED) to see if it is actually transmitting anything.

 

Or install Teraterm Pro or one of the other ones out there instead. They're usually easier to get going reliably.

 

Now you know you're transmitting from the micro, just link its RX and TX and see if it can receive its own transmissions.

 

View solution in original post

0 Kudos
Reply
8 Replies
1,165 Views
TomE
Specialist II

Which Coldfire CHIP are you using? Not every Coldfire chip has an SCI.

 

Making the assumption you're using something like the MCF51CN128 or equivalent...

 

> Nothing is written into it.

 

Because nothing is coming out of the serial data pin, or because you're trying to read it back?

 

UART Transmit Data registers are normally WRITE ONLY, just as the receive data registers are READ ONLY.

 

The MCF41CN128 manual says:

 

13.2.7      SCI Data Register (SCIxD)
This register is actually two separate registers. Reads return the contents of the read-only receive data
buffer and writes go to the write-only transmit data buffer. Reads and writes of this register are also
involved in the automatic flag clearing mechanisms for the SCI status flags.

On that chip, the RXD1 and TXD1 pins are ALTERNATE functions of the port pins, so you may need to program those pins to those alternate functions in order to send and receive data.

 

0 Kudos
Reply
1,165 Views
farhud
Contributor III

I am using the EVB51JM128. It has the MCF51JM128 on it. This chip has 2 SCIs. I am using the first one, SCI1. According to the manual each SCI module has one Data register, SCI1D. (The Tx and Rx are double buffered). My biggest question is why the content of the SCI1D register does change at all. I am basically just testing the SCI here. I loaded the code from AN2883 and the changed the register names to the ones on my chip. I can see the ISR getting called but like I said nothing is written into SCI1D. Do you have any idea?

0 Kudos
Reply
1,165 Views
TomE
Specialist II

The transmit register is WRITE ONLY.

 

That means you can't read it. It is not like a memory location.

 

By reading that address you are reading the RECEIVE data register.

 

The register will only change when the SCI receives data.

 

If you have the SCI port connected to a PC running Hyperterm or equivalent then:

 

1 - Data you write to SCI1D should show up on Hyperterm, and

 

2 - Data you type into Hyperterm should show up when you read SCI1D.

 

Don't try and write your own drivers or you'll be repeating the same mistakes we've all made handling the receive and transmit flags, bidirectional comms, interrupt and flow control. There's a lot to go wrong.

 

You might like to start here and then keep following the links:

 

http://en.wikipedia.org/wiki/Uart

 

0 Kudos
Reply
1,165 Views
farhud
Contributor III

Thanks for the link and the explanation. I finally got the Transmission working. As you mentioned, the data I write to SCI1D shows up on the HyperTerminal. Now my problem is that I can not get the Reception working. It looks the data I type in through my keyboard on the HyperTerminal does not reach MCU because the RDRF (Receive Data Register Full Flag) never gets set. Would you have any idea why?

0 Kudos
Reply
1,166 Views
TomE
Specialist II

Hyperterm is fussy and usually wants some of the other RTS/CTS/DTR/Whatever signals set. The DE9 serial port connector has 9 pins. You're using three. The other six are there to cause 2^6=64 varieties of trouble.

 

Make sure you've got "Hardware Handshake OFF" in Hyperterm, and use a scope (or even a LED) to see if it is actually transmitting anything.

 

Or install Teraterm Pro or one of the other ones out there instead. They're usually easier to get going reliably.

 

Now you know you're transmitting from the micro, just link its RX and TX and see if it can receive its own transmissions.

 

0 Kudos
Reply
1,165 Views
farhud
Contributor III

TomE,

 

I just downloaded the Tera Term Pro 3 but it is NOT communicating with my MCU. When I run the Hyper Terminal, the SCI module of the MCU is showing a desired result. I want to run the same program on Tera Term as well, but it doesn't look like it is actually communicating my PC port. Here is  what I did:

 

1. Went to Set up tab and configured it the same as I did for the Hyper terminal. Should I do anything else?

2. What is this "key code" icon in my installation folder. When I run it, it asks me to enter any key. It then gives me a number. Do you know anything about this?

0 Kudos
Reply
1,165 Views
farhud
Contributor III

disregard my last problem TomE. I has a setup issue.

0 Kudos
Reply
1,165 Views
farhud
Contributor III

TomE, you solved my problem. Thank you very much to taking your time and guiding me through it. (I am going to use a more reliable SSH but my main problem for RxD was the "Hardware Handshaking" thing. Now that I got the SCI running I can see if I can connect my GPS receiver to it!

0 Kudos
Reply