AnsweredAssumed Answered

STM8S Discovery and CCO

Question asked by stevens.mark on Apr 14, 2012
Latest reply on Apr 14, 2012 by stevens.mark
I am new at this so please be gentle with me :)  I am struggling to get the CCO pin to output the current clock frequency and I'm struggling.  I have checked out the examples in the STM8S library (version 2.1), in particular the CLK_MaxSpeed example and I seem to be getting no where.

For the hardware I am just using the Discovery board and I have hooked a scope to CN4, pin 4 which I believe is the CCO pin.

For the software I have distilled the following from various examples:

#include "stm8s.h"
#include "stm8s_gpio.h"
#include "stm8s_clk.h"
int main( void )
    //  Initialise the clock
    CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1);    //  CPU Prescaler = 1.
    CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV1);    //  Prescaler = 1.
    CLK_CCOConfig(CLK_OUTPUT_CPU);              //  Output clock on CCO pin.
    //  Initialise GPIOs
    GPIO_WriteHigh(GPIOC, GPIO_PIN_2);
    //  Config done.
    while (1)
        GPIO_WriteReverse(GPIOC, GPIO_PIN_2);

The while loop is just me trying to get some other form of output to prove the program is actually running.  I am not seeing any meaningful output on the scope for either CCO or the GPIO.

FYI - I am using the IAR environment.

Any help would be appreciated,