AnsweredAssumed Answered

S08PA4 SCI and Flextimer not working.

Question asked by Omar Ayala on Aug 25, 2014
Latest reply on Sep 19, 2014 by Omar Ayala



I am having problems with the SCI and Flextimer modules of a S08PA4 (16Pin). The system clock is set to 20MHz.

I just need to transmit so I deactivated the Rx part. The transmission is configured as follows:

8 Bit, Boud rate is set to156kbps, No parity and no interrupts activated (I use a polling mechanism)


void InitSCI0Module_v(void)


SCI0_BDH = 0x00;

SCI0_BDL = 0x08; /*Set BR to 156k bps */

SCI0_C1 = 0x00; /* RxD and TxD use separate pins, 8 Bits, Parity disabled, SCI clocks continue to run in wait mode, */

SCI0_C2 = 0x08; /* Receiver is off,Transmitter is on, No iterrupt but polling */

SCI0_C3 = 0x00; /* Transmit data not inverted */



void TX_Data_v(void)

{ /* Transmit only if buffer is empty */


  {/* Load byte */

  SCI0_D = Data_u8; /* Data_u8 updated in another function */



#define TRUE              0x01

#define Sys_D_BIT7    0x80

#define TX_BUFFER_EMPTY    ((SCI0_S1 & Sys_D_BIT7) == Sys_D_BIT7) /* Transmit Data Register Empty Flag */


With a Debugger I can see that when I call the function TX_Data() the transmit buffer is empty (flag is set) and that after loading Data_u8 in the A register the assembler command STA SCI0_D is executed but the register SCI0_D register does not change its value. Am I forgeting something? Does anyone have an idea of what is not correct?


Now the next topic is with the Flextimer.

I need to configure the Channel 0 as input capture in the pin PTA2. Here is how I initialize the module.


void InitPinOptions_v(void)


SYS_SOPT1 = 0x2C; /* FTM0 on PTA2 and PTA 3, PTA4/ACMPO/BKGD/MS as BKGD function */

SYS_SOPT2 = 0x00; /* Just as default */

SYS_SOPT3 = 0x00; /* Just as default */



void InitTimerModule_v(void)


FTM0_SC = 0x08; /* Over flow interrupt disabled, Counting up, System clock, no clock divider (20MHz) */

FTM0_MOD = ZERO_U16; /* Free running configuration */

FTM0_C0SC = ; /* Interrupt enabled, input capture for rising edge */

FTM0_C1SC = ZERO_U8; /* Channel 1 not used */



The interrupt function is correctly mapped (FFDE:FFDF) and global interrupts are activated.

I just connect a square signal to the pin PTA2 with an appropiate frequency and amplitude, but the mC does not jump to the interrupt function.


Again my questions. Am I forgeting something? Does anyone have an idea of what is not correct?


Best regards,




Nachricht geändert durch Omar Ayala. Hi, I just made a correction: When the transmit buffer is empty the flag is set and not cleared as I posted in my original description.


Nachricht geändert durch Omar Ayala: Hi, another correction. To get the 156 Kbps the SCIo_BDL must be loaded with SCI0_BDL = 0x08 and not 0x04. I just made a small test before with the Value 0x04 and forgot to correct the comment. The speed that I want to configure is 156Kbps.


Nachricht geändert durch Omar Ayala: Hi I just added some of the defines that I use.