06-11-2018 05:49 AM
We are currently working on system where there are two OSes on ZCU102 platform:
- FreeRTOS on R5
- Petalinux on A53.
We successfully tested OpenAMP echo test application and based on that create some communication shame between processors.
On FreeRTOS we would like to use SPI0 (with the usage of EMIO on FPGA). We succeeded in using SPI0 in standalone FreeRTOS application. However when we try to run the same application from Petalinux as ug1186 described the SPI do not work. SPI registers are continuously read as zeros.
In one of version of ug1186 I found fallowing statements:
With ZynqMP, PetaLinux default BSP does not define specific subsystems, as isolation configuration is disabled. All devices are shown in the device tree (DTS) and Linux owns everything.
By default, power management (PM) is enabled in the Linux kernel configuration, and thus Linux can suspend its devices.
When RPU is used and needs to access some device, you must do one of the following:
• Use isolation configuration in Vivado to setup subsystems. Note: This doesn't cover programmable logic (PL) devices; for those used by RPU you still need to disable them manually in the DTS.
• Manually disable devices owned by the RPU in the DTS.
I tried both options and non of them works. (Probably I'm making some mistakes in both cases).
After that I manually tried to init SPI (with devmem command on Petalinux). The SPI started to work after clearing bit nr 3 from RST_LPD_IOU2 register (Absolute Address: 0xFF5E0238 -CRL_APB). Now I'm trying to apply that into Linux or into hardware definition but I do not know how to do that. Any help?
06-11-2018 08:45 AM
Can you provide a snippet of the device-tree after disabling spi0?
Are there any other peripherals being used by the RPU also present in the dts? All of these must be disabled in the dts if being used by the RPU
06-11-2018 10:17 PM - edited 06-11-2018 11:18 PM
Thanks for answer.
Here is the way I disabled the SPI0:
status = "disabled";
Another thing is that in the system-top.dts there is an alais:
ethernet0 = &gem3;
serial0 = &uart0;
spi0 = &qspi;
I'm worried that after this real SPI0 is "covered" by QSPI and I disable only QSPI instead of wanted interface, do I?
We also use SPI0 through EMIO because ZCU102 do not have dedicated MIO to connect SPI0 (everything is occupied). Maybe this is another problem. Do I need disable/define something else in dts to use EMIO?
And I need to add something to previous post. When I said that "SPI started to work" I mean that the selftest PASSED. The RTOS was able to read config register default value and it was 0x00200000 as expected. Whats more RTOS is able to read/write to SPI registers because I see the changes in this registers. Unfortunately on the PINs I do not see physical signal yet. I'm currently working on that.
06-12-2018 12:50 AM
I manage to run SPI0. The communication works through EMIO. However I need to do few things so that it will work as I expected:
1. Enable SPI0 manually from Linux with command:
devmem 0xFF5E0238 32 0x00010B0
This command clears reset flag on RST_LPD_IOU2 register
2. Set assumed RPLL CLK divisions from Linux with command:
devmem 0xFF5E007C 32 0x01031900
This set up SPI0_REF_CTRL register so that SPI will have frequency clock 10MHz.
I think both of this should be set up in Vivado project and I think it was done properly. Based on that petalinux configuration was prepared with commands:
$petalinux-config -c kernel
$petalinux-config -c rootfs
I will repeat that process to be sure of that. However for now it seems that petalinux does not take this set up into account. The question is why?
06-14-2018 11:14 PM
The solution of the problem is in:
This topic is a repetition of above one. Sorry for confusion but first one was initially marked as spam so I started a this one. After that the original one was restored.