Atmel Start & Frequency Meter on ATSAMC21J18A

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to use the Frequency Meter to measure an external signal, with Generic Clock Generator (GCG)1 as reference, & GCG2 as measurement inputs.

The attached *.atstart defines the system, with GCG2 temporarily hooked to the XOSC input (here, 25MHz). "Save Configuration" works OK, but "Export Project" fails, reporting:

"Project Generation Error: Unable to generate project."

 

When I reassign GCG2's input to the "Generic clock generator input pad" (it's intended final connection), neither Save nor Export work.

"Save Configuration" reports: [line breaks inserted to improve readability]

"Bad Request.

{'clocks': '(\'Could not create clock links for the following clocks: %s\',
  [(<DriverInstance Atmel:SAMC21_Drivers:0.0.1
  ::SAMC21J18A-AN::FREQM::driver_config_definition::Frequency.Meter
  ::HAL:Driver:Frequency.Meter.Sync>,
  <ClockNodeGroupDefinition Atmel:SAMC21_Drivers:0.0.1::SAMC21J18A-AN
  ::node_group_definition::FREQM~20clock~20domains "FREQM clock domains"\n\t
  <ClockNodeDefinition Atmel:SAMC21_Drivers:0.0.1::SAMC21J18A-AN::node_definition
  ::FREQM~2FMSR "MSR">\n\t<ClockNodeDefinition Atmel:SAMC21_Drivers:0.0.1
  ::SAMC21J18A-AN::node_definition::FREQM~2FREF "REF">\n>),
  (<DriverInstance Atmel:SAMC21_Drivers:0.0.1::SAMC21J18A-AN::GCLK
  ::driver_config_definition::GCLK::HAL:HPL:GCLK>,
  <ClockNodeDefinition Atmel:SAMC21_Drivers:0.0.1::SAMC21J18A-AN::node_definition
  ::Generic~20clock~20generator~202 "Generic clock generator 2">)])'}"

  Export Project fails as before, reporting:
  "Project Generation Error: Unable to generate project."

 

Attachment(s): 

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like start has some (incorrect) limitations in the clock setup, at least:

* problem with dividing GCLK1 (DIV is 16 bits but the limit is much lower).

* The "Generic clock generator input pad" setting, could be it's the computed frequency 0 Hz that is a problem for the Frequency Meter config.

Maybe you can find a working setup in start and fix the generated code to get the actual wanted config.

/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for that. I found 2 issues: it now works, so Solved!

1. As you say, GCLK1 won't divide by 25000. So dividing by 2500, ie to 100kHz, then using GCLK5 (arbitrary choice) to drop further to 10kHz, as REF.

    This was the cause of it refusing to generate.

2. Stepping through with the debugger showed that, after setting up GCLK2, the code waits for a "running" signal. With no input to GCLK2 (there is none as the system powers up), the code hangs. Fixed this by initialising with GCLK2 driven from XOSC, so there is something to start it up. Then re-assigning GCLK2 source to the external pin when all else is ready.

 

Dave