Hi Bernd, On 1/28/20, Bernd Walter <be...@bwct.de> wrote: > I have had problens with a new SAM4S based board in that it hang eraly > during startup, before initializing my 12MHz xtal. > Also the SWD didn't work anymore until I erased the chip. > Since the SWD didn't work it was quite obvious that there is some clock > related issue. > I've found out that the startup code unconditionally switches to an > external 32kHz xtal. > On my board I didn't need one. > Interestingly I had no such problem on a SAM4E board, but there is > a small difference between those boards in that the SAM4E has XIN32/XOU3 > pins unconnected and the SAM4S has XIN32 used as GPIO. > Or maybe the SAM4E just behave differently when trying to init an unhooked > 32kHz xtal. > However, after commenting the sam_supcsetup() call my board worked fine. > I think there should be an option to initialize the 32kHz xtal or not. >
Please check how other boards are doing it. Normally you have a DEFINE USE_CLOCK_XYZ inside the boardname/include/board.h. I faced an issue similar to your on SAMD21, it was defined to use external crystal, but my board didn't have one. When I enabled the internal clock the serial console wasn't working correctly. Then Alexander noticed that it was missing a function to read the NVRAM calibration data to use with the internal RC clock. BR, Alan