Hi,
have you checked the signals by oscilloscope? How does it look like? We have this application note that describes how to connect 5V system to 3.3V:
http://www.freescale.com/files/microcontrollers/doc/app_note/AN2433.pdf
And I found simple example for echo test in my repository, see please below.
Regards,
Lukas
| #include <hidef.h> | /* common defines and macros */ |
| #include <mc9s12c32.h> | /* derivative information */ |
#pragma LINK_INFO DERIVATIVE "mc9s12c32"
//==============================================================================
// SCI_ISR
//==============================================================================
#pragma CODE_SEG NON_BANKED
interrupt 20 void SCI_ISR(void)
{
unsigned char scicr2,scisr1,sc0_data_in;
| scisr1 = SCISR1; | //save status register actual status |
| scicr2 = SCICR2; | //save control register actual status |
//--- if receiver interrupt is enabled and corresponding interrupt flag is set
if((scicr2 & SCICR2_RIE_MASK) && ((scisr1 & (SCISR1_OR_MASK | SCISR1_RDRF_MASK))))
{
| if(scisr1 & SCISR1_OR_MASK) | //if overrun error do nothing/something |
| | { |
| | (void)SCIDRL; | //clear interrupt flag |
| | // do something |
| | } |
| else |
| | { |
| | sc0_data_in = SCIDRL; | //read received character + clear interrupt flag |
| | |
| | while(!SCISR1_TC); | //wait if transmission is in progress | |
| | SCIDRL = sc0_data_in; | //send back |
| | } |
}
}
#pragma CODE_SEG DEFAULT
//==============================================================================
// SCI_Init
//==============================================================================
void SCI_Init(void)
{
//SCIBD = BUSCLK / (16*Baud rate) = 8000000 / (16*9600) = 52 = 0x34
SCIBDH = 0x00; //prescaller value
SCIBDL = 0x34; //prescaller = 0x34
SCICR1 = 0x44;
SCICR2 = 0x2C; //transmitter enable
}
//==============================================================================
// main
//==============================================================================
void main(void) {
SCI_Init();
EnableInterrupts;
for(;;) {} /* wait forever */
/* please make sure that you never leave this function */
}