I am trying to generate a clock output (pulse) on the CANRX pin of the Due but no luck.
Here is my code:
pmc_set_writeprotect(false);
pmc_switch_pck_to_mainck(0,4);
pmc_enable_pck(PIO_PA1B_PCK0);
I am trying to generate a clock output (pulse) on the CANRX pin of the Due but no luck.
Here is my code:
pmc_set_writeprotect(false);
pmc_switch_pck_to_mainck(0,4);
pmc_enable_pck(PIO_PA1B_PCK0);
This sets the CANRX pin to output ~500Hz, you can use a piezo speaker to check if it is working.
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.
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?