Go Down

Topic: Programmable Clock Output Programming (Arduino Due) (Read 885 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy