Hi Antal,

> I'm trying to get CAN working, and I ran into this error:
> 'Can1' is not a member of 'xpcc::stm32::SystemClock<...>'
> As a reminder, I'm using the feature/stm32f103_support_experimental
> branch, which is using the experimentel system_clock branch, so that
> may be the problem.

Yes, unfortunately the Clock Trees are quite complicated.

The SystemClock is code-generated out of a template.
The Can driver expects the `SystemClock::Can1` to exist and contain the input 
frequency in Hz to the peripheral.

> I went looking for a solution, but I just cant find the definition of
> SystemClock anywhere, it's very frustrating. I found a million
> SystemClock-named template parameters and other things, but not what
> I'm looking for. Can someone help me with this?

All generated peripherals can be found inside the build folder.
The file you’re interested in is:

The generated code you’re interested in is:

The output frequencies are generated using this template:

Which uses the Clock Graph encoded here:

As you can see neither the input data, nor the generated code mentions any Can 
Output at all, which seems to be a mistake.
The fact is the clock tree was written for the F100, and it didn’t have CAN, so 
I just didn’t add it :-(.

ST is notoriously bad for not describing what the actual device ClockTree looks 
Looking at the Reference Manual of the F1 series, can you find which clock 
domain CAN1 is connected to?
I can’t. I have to look this up inside their source files every. single. time. 
It drives me nuts.

CAN1 is connected to the APB1 clock domain. (Also I2S and DAC)
So just add this:

        <output name=“Can1”/>

to the Apb1 subtree here: 

Recompile and it should just automagically work.


PS: You can add all your custom clock outputs this way. There might be more 
missing :-(

xpcc-dev mailing list

Reply via email to