Hello everyone,
I'm a long time reader but a first time poster here. I'm using an RS08KB2 microcontroller with CodeWarrior v10.1 and I'm having a lot of trouble receiving data through the SCI module. Everything I receive is gibberish.
To begin, I've re-mapped the SCI pins in SOPT1 since I'm using an 8 pin device. I also trimmed the ICS (I'm using a P&E Micro USB Multilink). At this point, I'm trying to get any meaningful data from the SCI module so I'm just polling it. Here's how I set the module up (I'm running the chip at the standard 4MHz bus speed):
SCIBD = 0x001A; // 9600 baudSCIC1 = 0x00;SCIC2 = 0x0C; // Enable RxD and TxD
Here's what I'm doing to receive the data ('test' is a 64 byte long array):
for(;;){ while(!SCIS1_RDRF); if(SCIS1_OR){ test[i] = SCID; } test[i] = SCID; i++ if(i>64){ i=0; }}Pretty straightforward, right? I've sent data through the transmitter and I'm measuring ~0.1ms per bit with my oscilloscope; I believe that corresponds to the correct 9600 baud rate. I've also connected the device I'm trying to read to my computer with a USB-serial adapter, and I can read the data with TeraTerm or HyperTerminal with no problems (8 data bits, no parity, 1 stop bit, no flow control).
The SCI module in the RS08 is receiving something, but it's complete nonsense. The data I received through TeraTerm consists of standard ASCII characters, the data I'm receiving through the SCI module is all over the place: nonsensical control characters, large numbers like 0xEB, 0x82, etc.
I figured maybe the BDM was impacting the timing, so at one point, I even had the code send a character on the TxD pin if it received a valid character. I ran the code, removed the BDM, and watched for changes on the oscilloscope: alas, nothing.
I'm not sure what's wrong, but I feel like I've tried everything! Thanks so much for your help!
-Paul