Saulius Jacenas

MC9S08QD4 bus speed, is it really 8Mhz??

Discussion created by Saulius Jacenas on Oct 3, 2007
Latest reply on Oct 3, 2007 by Saulius Jacenas
    Hello,

Just received new MC9S08QD4 micros. It says that it has 16MHz core and should have 8MHz bus speed. Trying to test it. Just a very simple program on CodeWarrior below. Timer that overflows after single tick (TMOD=1). But I see 104.2kHz on PTA0 with scope. What do I do wrong? (no external oscilator, INTERNAL)

#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */

interrupt 7 void TimerOverflowInterrupt() { //TIMER OVERFLOW INT
  TPMSC_TOF = 0;
  PTAD_PTAD0 = ~PTAD_PTAD0;
}

void InitializeTX(void) {
  TPMSC_TOIE = 0;  //Timer TPM1CH0 disable 0
  PTADD_PTADD0 = 1;
  TPMSC_CLKSB = 0;
  TPMSC_CLKSA = 1; // 01 bus clock
  TPMSC_PS2 = 0;
  TPMSC_PS1 = 0;
  TPMSC_PS0 = 0;  // clock not devided
  TPMMODH = 0;
  TPMMODL = 1;  // free run

  TPMC0SC_CH0IE = 0;  // 0 - channel interrupt disable
  TPMC0SC_MS0B = 0;
  TPMC0SC_MS0A = 1;
  TPMC0SC_ELS0B = 0;
  TPMC0SC_ELS0A = 0;

  TPMSC_TOIE = 1;  //Timer TPM1CH0 enable
}

void main(void)
{

SOPT1_COPE = 0; // 0 - disable watchdog, 1 - default after reset

 EnableInterrupts;
 
 InitializeTX(); 

 for(;:smileywink: {
  } /* loop forever */
}

Outcomes