UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
1,738 Views
Registered: ‎11-11-2015

devmem not working?

Jump to solution

I'm upgrading from ISE/Petalinux to Vivado/Petalinux 2018.3. Running on a custom board using a Zynq 7020. The application I'm working on uses mmap to access the Zynq peripherals (PS SPI, I2C, etc...) and does not use any of the drivers. When I try and run the application all reads from device registers after mmap are returning 0. I run the command line devmem utility and I read all 0's. E.g. For the PS SPI which is at address 0xE0006000 after a reset I read 0, when I run the (working) ISE image I read the expected reset value of 0x20000.

Back to my Vivado image, if I stop the boot and get to a u-boot prompt and do a "md 0xE0006000"  (memory display) I indeed see the expected 0x20000, but if I then boot Linux and do devmem I read 0.

So it looks like there is some issue doing the memory mapping? Has anyone else seen this? My ISE/Petalinux kernel is 3.8.11 (devmem works fine), my Vivado/Petalinux kernel is 4.14.0 (devmem always reads 0)

0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
1,465 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

In PetaLinux I disabled the Linux Kernel configuration  power management options "Suspend to RAM and standby" and "Device power management core functionality".  For some reason the kernel was putting my SPI into a suspended state. Once I disable power management I can communicate with the SPI.

View solution in original post

15 Replies
Adventurer
Adventurer
1,686 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

No ideas on why the md command in u-boot would read device registers correctly but mmap/devmem would return 0s?

0 Kudos
Moderator
Moderator
1,672 Views
Registered: ‎12-04-2016

Re: devmem not working?

Jump to solution

Hi @mashman

Try comparing the device tree files between these versions and check if there is any change in spi device entries (decompile system.dtb to system.dts and check)

 

Best Regards

Shabbir

0 Kudos
Adventurer
Adventurer
1,663 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

Thank you for the reply. Note I'm also seeing this with other devices, such as I2C..so I don't think this is a problem specifically with the SPI, but I've done a comparision between the older dts and the 2018.3 dts and I've shown the SPI node below. The newer dts is on the right

I'm not too familiar with the dts files so I'm not sure if any of these settings would cause the issues I'm seeing. I also included the aliases section from the dts, the older dts has spi0 as an alias for the ps7 spi but the newer dts has spi0 as an alias for the axi spi, though I don't see how that would contribute to the issue?

dtsComp.png

 

0 Kudos
Adventurer
Adventurer
1,647 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

to follow up, I changed the aliases to match what had was used in the working version and that had no effect.

I know that e.g., devmem works because I can query some system addresses, but when I try to query Ic2, SPI, etc...they return 0. Does that point to the devices not being enabled?

0 Kudos
Moderator
Moderator
1,637 Views
Registered: ‎12-04-2016

Re: devmem not working?

Jump to solution

Hi

Can you please hdf files of both the petalinux versions?

 

Best Regards

Shabbir

0 Kudos
Adventurer
Adventurer
1,629 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

The Vivado 2018.3 system.hdf is attached, renamed to Vivado2018.zip. The version of ISE I was using did not use hdf files so I zipped the relevant files and attached as ISE2014.zip

0 Kudos
Adventurer
Adventurer
1,597 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

I uploaded the requested files. Did you get them?

0 Kudos
Moderator
Moderator
1,578 Views
Registered: ‎12-04-2016

Re: devmem not working?

Jump to solution

Hi @mashman

To start with, Can you try to keep the 2018.3 design as minimal as possible, and give a try with this generated HDF, as I couldnt find any obvvious reasons for failing to accessing registers using devmem with ISE to vivado migration?

 

Best Regards

Shabbir

 

 

0 Kudos
Moderator
Moderator
1,575 Views
Registered: ‎09-12-2007

Re: devmem not working?

Jump to solution

Can you check to see if  the deivces that are not responding to the devmem are getting probed by the kernel?

dmesg | grep <ip name>

 

 

0 Kudos
Scholar pedro_uno
Scholar
1,559 Views
Registered: ‎02-12-2013

Re: devmem not working?

Jump to solution

I also use /dev/mem and mmap() to access AXI addresses directly without the "help" of device drivers and trees.

In a case like this it is nice to see what physical address is actually going out on the AXI bus.  Normally, when I am building the FPGA logic design for something like this I attach a System ILA on the AXI master bus.  It is very easy to add in the IP Integrator and easy to use in the Hardware Manager.

I think you are on the right path. Good luck.

----------------------------------------
DSP in hardware and software
-----------------------------------------
Adventurer
Adventurer
1,547 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

The top image below is the result of dmesg for spi for my latest (2018.3). The bottom image is the result of dmesg spi for my working image (ISE / Petalinux 2014). I'm having issues with the PS spi at e0006000

 

dmesg.png

0 Kudos
Moderator
Moderator
1,540 Views
Registered: ‎12-04-2016

Re: devmem not working?

Jump to solution

Hi @mashman

Can you try listing the device nodes in both the cases,  /dev/spi*

 

Best Regards

Shabbir

 

0 Kudos
Adventurer
Adventurer
1,531 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

I don't see the spi device in /dev, instead in both versions I see it in /sys/devices. The top image shown is from my working ISE/PetaLinux version, the bottom image is from my non-working Vivado/PetaLinux.

It seems to be a problem with the PS SPI and I2C peripherals. I seem to be able to access the registers of the AXI SPI..something specific to the PS.

 

devicesLs.png

0 Kudos
Adventurer
Adventurer
1,486 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

If I use my Vivado generated boot.bin and my ISE generated image.ub I can read the PS SPI registers with no issues. So the problem seems to by with the kernel or the device tree. I dont' see anything obvious in the device tree that would cause this though?

0 Kudos
Adventurer
Adventurer
1,466 Views
Registered: ‎11-11-2015

Re: devmem not working?

Jump to solution

In PetaLinux I disabled the Linux Kernel configuration  power management options "Suspend to RAM and standby" and "Device power management core functionality".  For some reason the kernel was putting my SPI into a suspended state. Once I disable power management I can communicate with the SPI.

View solution in original post