News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

Petalinux and CAN Controller on ZynqBerry TE0726

Started by pb, February 22, 2017, 04:10:11 PM

Previous topic - Next topic

pb

Hi,

I am trying to use the PS CAN controllers on the ZynqBerry. I started with a Vivado project (2015.2) and configured the PS with both CAN controllers. With the exported HDF and bitstream I can use the CAN controllers on CPU 0 and CPU 1, after I followed the instructions from XAPP 1079.

In my final approach I would like to use Petalinux on CPU 0 and baremetal on CPU 1. I followed the instructions from your Petalinux KICKstart and Xilinx UG1144. I don't have any problems so far, but I can't use the CAN controllers on CPU 1 in this setup. I figuered out that the AMBA Peripheral Clock Control (APER_CLK_CTRL: 0xF80012C) and CAN Ref Clock Control (CAN_CLK_CTRL: 0xF800015C) registers are not set after booting Linux. I also checked the FSBL. After the FSBL the registers are configured correctly.

So apparently uboot does some changes to the registers.
How can I change this behaviour?
In "zynq-7000.dtsi" both controllers are listed:

can0: can@e0008000 {
   compatible = "xlnx,zynq-can-1.0";
   status = "disabled";
   clocks = <&clkc 19>, <&clkc 36>;
   clock-names = "can_clk", "pclk";
   reg = <0xe0008000 0x1000>;
   interrupts = <0 28 4>;
   interrupt-parent = <&intc>;
   tx-fifo-depth = <0x40>;
   rx-fifo-depth = <0x40>;
};

I tried to change the status, but without effects. From my understanding I have to make changes to "system-top.dts". I don't have any definitions for the CAN controllers in this file.

Can you give me some hints on how to make changes to uboot? Or to the device tree so the controllers will be initialized correctly? (Or no other initialization is performed, since the CAN controllers are configured correctly after the FSBL)

Thanks in advance

Oleksandr Kiyenko

Hi pb,

think that there is 2 ways to work with u-boot
1. modify u-boot config
check subsystems/linux/configs/u-boot/platform-auto.h for CAN settings and undefine it in subsystems/linux/configs/u-boot/platform-top.h
2. use your own custom u-boot repository

Also for test you can disable CAN driver in linux and check registers after linux boot, this way you can define if linux driver overwrite it.

Best regards
Oleksandr Kiyenko

pb

Hi Oleksandr,

thanks for your reply.

I checked both files from option 1 that you mentioned.
platform-auto.h does not have any settings for CAN. platform-top.h only has an #include to platform-auto.h

Can you give me some further advice on how to modify u-boot respectively how to modify u-boot config?
Thanks

Oleksandr Kiyenko

Hi pb,

U-Boot is using not only it's own configuration files but also linux configuration, I had problems with this behaviour before.
You can try to made test project which don't have CAN controllers enabled, and build complete petalinux for it, than replace u-boot binary in your main project by binary from this test project.


Best regards
Oleksandr Kiyenko

pb

Hi Oleksandr,

could you be a bit more precise on how you solved your problem?
I tried to disable the CAN support from "petalinux-config -c kernel" without success. The settings from the FSBL to CAN and AMBA are overwritten after linux boot.

I don't understand at which point in booting linux the settings are overwritten? Is there a reset to the CAN controller in the boot sequence? (This would reset all settigs and disable the CAN controller)

Thank you.

Oleksandr Kiyenko

Hi,

I did't work much with CAN, but I have problems before with u-boot configuration for SPI and Ethernet. Disabling comething in kernel config not affect to device tree or u-boot settings.
U-Boot in petalinux take some settings from linux device tree and it can affect to u-boot behaviour regardless of u-boot config.
So I propose to create another small test project without CAN in FSBL and Linux and build u-boot for this configuration. This u-boot binary can be used in main project, this way we can check if some u-boot or
linux settings affect to u-boot CAN behaviour.

Best regards
Oleksandr Kiyenko