Hi, I'm using MicroZed board, and try to read/write SPI registers via /dev/mem. However, each time when I use devmem2 to write data to SPI registers, the value read back is always zero, like below:
root@xxxxxx:~# devmem2 0xe0006000 w 0x27e19
/dev/mem opened. Memory mapped at address 0xb6fda000.
Value at address 0xE0006000 (0xb6fda000): 0x0 Written 0x27E19; readback 0x27E19
root@xxxxxx:~# devmem2 0xe0006000
/dev/mem opened. Memory mapped at address 0xb6eff000.
Value at address 0xE0006000 (0xb6eff000): 0x0
And Here is what I did in my design:
a) I use Vivado to create hardware design based on MicroZed board, and only add SPI0 and SPI1. It seems EMIO is used for SPI0 and MIO for SPI1. After that, I just sync, implementation, and generate bitstream and HDF file.
b) I import HDF into Petalinux, and enable the following SPI configuration in kernel:
Cadence SPI Controller
Xilinx SPI controller common module
Xilinx Zynq QSPI controller
User mode SPI device driver support
c) Then, run petalinux-build.
d) I copy BOOT.BIN and image.ub to MicroZed board, and run. At this time, I use devmem2 to read/write both SPI0 and SPI1, the physical address is 0xe0006000 and 0xe0007000.
Am I missing something during steps above? Please give me some hints or suggestions. Thank a lot.