Clocks and IO Pins on ATSAM bsp

Isaac Gutekunst isaac.gutekunst at vecna.com
Fri Jun 10 15:15:02 UTC 2016


Hi Everyone,

I'm moving along with our project here at Vecna, and am working to bring up the MCAN controller on the ATSAMV71Q21 processor. I'm having a fun time figuring out the clock tree, and bringing the peripheral up.

Are there any recommended ways of configuring all the clocks and enabling the GPIO pins to bring up a peripheral?

I'm doing an awkward mix of calling functions provided by Atmel, e.g. PIO_Configure(pinsMcan1, PIO_LISTSIZE(pinsMcan1)); (wrapped in a #ifndef __rtems__ in mcan.c), and twiddling bits in the variou PMC control registers: e.g.

   PMC->PMC_PCK[5] &= ~(PMC_PCK_CSS_Msk);
   PMC->PMC_PCK[5] |= ((2 << PMC_PCK_CSS_Pos) & PMC_PCK_CSS_Msk);

   PMC->PMC_PCK[5] &= ~(PMC_PCK_PRES_Msk );
   PMC->PMC_PCK[5] |= ((11 << PMC_PCK_PRES_Pos ) & PMC_PCK_PRES_Msk);


   PMC_EnablePeripheral(ID_MCAN1);;
   PMC->PMC_PCR |= (PMC_PCR_CMD);
   PMC->PMC_PCR |= (PMC_PCR_PID(ID_MCAN1));


So far, I haven't gotten the peripheral to work, but that's a matter of struggling forward. I'm curious if anyone has already figured any of this out, and can offer advice.


Thanks,

Isaac


More information about the users mailing list