Go Down

Topic: Programmable Clock Output Programming (Arduino Due) (Read 847 times) previous topic - next topic

dishimwe

I am trying to generate a clock output (pulse) on the CANRX pin of the Due but no luck.
Here is my code:
Code: [Select]
pmc_set_writeprotect(false);
        pmc_switch_pck_to_mainck(0,4);
        pmc_enable_pck(PIO_PA1B_PCK0);       

stimmer

This sets the CANRX pin to output ~500Hz, you can use a piezo speaker to check if it is working.
Code: [Select]

  pmc_switch_pck_to_sclk(PMC_PCK_0,PMC_PCK_PRES_CLK_64);
  pmc_enable_pck(PMC_PCK_0);   
  PIO_SetPeripheral(PIOA, PIO_PERIPH_B, PIO_PA1B_PCK0);


Once you have it working you can change the first line to the right clock and divider you need.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

dishimwe

Thanks! I can get the right frequency but the signal does not seem to be a clean square wave. Do you know how to fix that?

Go Up