Hello:
I have some problems with my freescale controller.
When I debug the SCI program, the value of the SCI1DRL register is always 0;for example,after runing "SCI1DRL = 0x55;" the value of SCI1DRL is 0x00,and the value of SCI1SR1_TDRE is always 1,using the serial port debugging assistant, the value of I get is 0x85.
When I run "SCI1DRL = 0xaa;/*SCI1DRL = other data;*/" ,the value of I get is wrong.
I want to know how to solve the problem.
Original Attachment has been moved to: main.c.zip
Thanks,I will go back to try again and feedback the result
-原始邮件-
发件人:"danielmartynek"<admin@community.nxp.com>;
发送时间:2017年2月28日(星期二) 晚上7:58
收件人:"杜太磊 杜"<956326010@qq.com>;
主题:Re: - Re: SCI sending problem - MC9S12XS128
NXP Community
Re: SCI sending problem - MC9S12XS128
reply from Daniel Martynek in S12 / MagniV Microcontrollers - View the full discussion
Hi
�
You can look at the attached example.
Although it is written for S12XEP100, the SCI module is the same.
�
Regards
Daniel
Reply to this message by replying to this email, or go to the message on NXP Community
Start a new discussion in S12 / MagniV Microcontrollers by email or at NXP Community
Following Re: SCI sending problem - MC9S12XS128 in these streams: Inbox
This email was sent by NXP Community because you are a registered user.
You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences
Hi,
Each SCI has 2 Rx and 2 Tx registers.
Two Rx registers means SCIDR and its shift register.
Two Tx registers means SCIDR and its shift register.
The observer is able to see only 1 Rx and 1 Tx register even they have the same name SCIDR. The MCU recognizes access to these registers on the basis whether register is being read or written.
Remaining Rx and Tx registers are shift registers and they are not visible to user. So if you write to SCIDR and Rx shift register is empty then data are immediately shifted to this register and transmitting starts.
When data is receiving they are stored inside receive buffer and when the byte is completed it is shifted to Rx register SCIDR.
When we want to TX data then we write it into SCIDR register and it is consequently moved to a shift register. The user is not able to read these transmit registers..
I suggest you to test the SCI in loopback mode to be able to see in the Rx what you are sending in the Tx.
Best regards,
Ladislav