Interfacing two HC08's with SCI

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

Interfacing two HC08's with SCI

Jump to solution
678 Views
kraete
Contributor I

Hey chums,

 I've got HC08's i plan on hooking up to a TLP/RLP434a pair and making a remote control car out of it. I'm essentialy done with the hardware but I'm having trouble programming the SCI interface. To test the code i've just been using a wire from the Tx on the master HC08 to the RX on the slave HC08, from what I gather from CodeWarrior (when the pair isn't attached) the master is properly transmitting and the reciever is waiting for the Recieve Data Full flag to go high. Unfortunately when i have the whole setup attached CodeWarrior spits a "Trigger A&B" error at me, after disabling triggers I instead get a "invalid BP" error. That engineering 6th sense we all have tells me to look at the interrupt routine, but I'm teaching myself this whole SCI interface dealy so I could be way off base here.

 

TL;DR: Would you kindly peruse my SCI interface code and point out any flaws you see? Thank you.

 

 

Attachments:  TxRx.zip contains the following files:

                         master.c                          //the master control file

                         my_SCI_master.c         //included by master.c

                         slave.c                             //the slave ontrol file
                         my_SCI_slave.c            //included by slave.c, contains interrupt routine responsible for recieving data

Labels (1)
0 Kudos
1 Solution
438 Views
bigmac
Specialist III

Hello, and welcome to the forum.

 

Actually, I do not think that you are "done with the hardware".  These very cheap, low power transmitter and receiver modules that use OOK modulation are not suitable for direct use with the SCI module, and its NRZ operation.  To provide a consistent operating threshold for "slicing" the data output requires that the modulation method provides at least one on-off transition for each data bit.  This does not occur for the SCI output, where the number of transitions within a byte will widely vary, depending on the data being sent.

 

A further issue may be the presence of noise at the receiver output in the absence of a signal.  Your decoding solution must discriminate this noise by virtue of its random timing.

 

For OOK operation, you might utilize a phase encoded modulation method, such as Manchester coding, or use a PWM method.  Because of the very low transmitter power levels of a few milliwatts, the range will be limited to perhaps 15-25 metres only.

 

Error detection is typically provided by transmitting each data sequence multiple times, with a successful decode when the same sequence is received two or three times in succession.  The data sequence would probably not exceed 32 bits in length.  This approach is therefore not suited to a continuous data stream, but is intended for very simple control applications.

 

With the presence of random noise fluctuations from the receiver, the code must test the timing of each transition to determine the start of the data.  This may mean that the MCU is "very busy", even when there is no signal.  For some applications, this may be unacceptable for the main MCU, and in such cases a separate MCU would handle the decoding.

 

Perhaps you should utilize alternative transmitter and receiver modules that internally encode and decode the data, provide for error detection/correction, and use a SCI interface to the MCU.

 

As least part of your coding issues appear to be that the main function for the slave may potentially exit.  This is not allowable.  Another possibility is that you have a COP timeout reset.  The cause of each reset may be determined from the SRS register.

 

Regards,

Mac

 

View solution in original post

0 Kudos
2 Replies
439 Views
bigmac
Specialist III

Hello, and welcome to the forum.

 

Actually, I do not think that you are "done with the hardware".  These very cheap, low power transmitter and receiver modules that use OOK modulation are not suitable for direct use with the SCI module, and its NRZ operation.  To provide a consistent operating threshold for "slicing" the data output requires that the modulation method provides at least one on-off transition for each data bit.  This does not occur for the SCI output, where the number of transitions within a byte will widely vary, depending on the data being sent.

 

A further issue may be the presence of noise at the receiver output in the absence of a signal.  Your decoding solution must discriminate this noise by virtue of its random timing.

 

For OOK operation, you might utilize a phase encoded modulation method, such as Manchester coding, or use a PWM method.  Because of the very low transmitter power levels of a few milliwatts, the range will be limited to perhaps 15-25 metres only.

 

Error detection is typically provided by transmitting each data sequence multiple times, with a successful decode when the same sequence is received two or three times in succession.  The data sequence would probably not exceed 32 bits in length.  This approach is therefore not suited to a continuous data stream, but is intended for very simple control applications.

 

With the presence of random noise fluctuations from the receiver, the code must test the timing of each transition to determine the start of the data.  This may mean that the MCU is "very busy", even when there is no signal.  For some applications, this may be unacceptable for the main MCU, and in such cases a separate MCU would handle the decoding.

 

Perhaps you should utilize alternative transmitter and receiver modules that internally encode and decode the data, provide for error detection/correction, and use a SCI interface to the MCU.

 

As least part of your coding issues appear to be that the main function for the slave may potentially exit.  This is not allowable.  Another possibility is that you have a COP timeout reset.  The cause of each reset may be determined from the SRS register.

 

Regards,

Mac

 

0 Kudos
438 Views
kraete
Contributor I

Do you happen to know of any good transmitters that would work better with my project? I was recommended this one by why electronics professor i assumed it would work im kinda bummed

0 Kudos