Re: [xpcc-dev] Trying to get CAN working

2016-02-05 Thread Kevin Laeufer



On 05/02/16 02:59, Szabó Antal wrote:

This is how I initialize Can1:

 GpioInputB8::connect(Can1::Rx, Gpio::InputType::PullUp);
 GpioOutputB9::connect(Can1::Tx, Gpio::OutputType::PushPull);
 Can1::initialize(9);
 CanFilter::setFilter(0, CanFilter::FIFO0,
CanFilter::ExtendedIdentifier(0), CanFilter::ExtendedFilterMask(0));

So yes, it does, and I have no idea why.


Did you make sure, that your version of xpcc includes the latest CAN code?

Try the latest version for STM32F103 from Niklas: 
https://github.com/salkinium/xpcc/commits/4ca26ba6d896cc0e55e182b5cd1f19e1424657a3


The old code did not properly detect unsupported frequencies. This was 
changed in commit 8cdc210dafd1d9d7424857ed2efd5e8643ac4454



If you want to calculate timing constants for your Frequency, you can 
find the python script that I used to generate the constants here: 
https://gist.github.com/ekiwi/51573729365405fef89c


Best of luck!

Kevin
___
xpcc-dev mailing list
xpcc-dev@lists.rwth-aachen.de
http://mailman.rwth-aachen.de/mailman/listinfo/xpcc-dev


Re: [xpcc-dev] Trying to get CAN working

2016-02-04 Thread Niklas Hauser
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:
build/stm32f103/blink/libxpcc/generated_platform/driver/clock/stm32/sinks.hpp

The generated code you’re interested in is:
https://gist.github.com/salkinium/3624a2c4ff73b2ec6892#file-sinks-hpp-L194-L239

The output frequencies are generated using this template:
https://github.com/salkinium/xpcc/blob/feature/stm32f103_support_experimental/src/xpcc/architecture/platform/driver/clock/stm32/sinks.hpp.in#L157-L175

Which uses the Clock Graph encoded here:
https://github.com/salkinium/xpcc/blob/feature/stm32f103_support_experimental/src/xpcc/architecture/platform/devices/stm32/stm32f103-r_v_z-c_d_e.xml#L105-L155

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 
like.
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.

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



to the Apb1 subtree here: 
https://github.com/salkinium/xpcc/blob/feature/stm32f103_support_experimental/src/xpcc/architecture/platform/devices/stm32/stm32f103-r_v_z-c_d_e.xml#L123

Recompile and it should just automagically work.

Cheers,
Niklas

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


___
xpcc-dev mailing list
xpcc-dev@lists.rwth-aachen.de
http://mailman.rwth-aachen.de/mailman/listinfo/xpcc-dev


Re: [xpcc-dev] Trying to get CAN working

2016-02-04 Thread Niklas Hauser
Hi,

> Ok.
> Radical idea: Forget SystemClock and configure the clock yourself.
> We did this for the STM32F072, which has the same problem of not having 
> SystemClock support.
> […]
> You then are free of the SystemClock dependency and should be able to just 
> use the normal develop branch.

You still need to copy the linkerscripts though :-(

I have a Nucleo-F103RB lying around, so I might give this a try on the weekend.
http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF259875

Niklas
___
xpcc-dev mailing list
xpcc-dev@lists.rwth-aachen.de
http://mailman.rwth-aachen.de/mailman/listinfo/xpcc-dev