• 0
Frankly

Reading Zybo Z7-20 OTP QSPI flash with Petalinux

Question

I understand from the Z7-20 reference manual (https://reference.digilentinc.com/reference/programmable-logic/zybo-z7/reference-manual#quad-spi_flash) that there's a 48bit unique identifier within the OTP region of the QSPI flash. What is the recommended way of reading this within a petalinux project for use as part of an Ethernet MAC? Modifying the bootloader? Can it be done from userspace? I've seen references to u-boot being able read this value and using it to set the MAC, but I haven't quite figured out how to enable this. 

I can see that https://github.com/Digilent/Petalinux-Zybo-Z7-20 claims to do this exact thing, read the identifier and set the MAC, but I'm somewhat at a loss for how this is accomplished, and how I can add this functionality to my own 2018.2 petalinux project.

I believe I'm able to read the QSPI's main array, in u-boot using the sf utility, and in userspace using the mtd_debug utility, but I'm not sure if/how either of these tools are able to read the OTP areas. From the doc (https://www.cypress.com/file/448601/download) it looks like the OTP read command is separate from the other read commands and refers to a different address space.

I feel like I've overlooked something obvious. Any direction would be appreciated.

 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello Frankly and welcome to our forum.

Here are 2 patches that can be applied on top of a Petalinux 2019.1 project to allow reading the OTP MAC and configure it to do so. You can try applying them on 2018.2.

Message us back if you have any issues.

Cosmin

0001-Z7-20-allow-reading-MAC-address-from-OTP.patch 0002-Z7-20-use-OTP-MAC.patch

Edited by Cosmin

Share this post


Link to post
Share on other sites
  • 0

Thank you so much Cosmin, this sorted me out! I had to tweak the patches slightly to work with 2018.2 but it was easy and straightforward. 

For the future reader's sake: the only notable change I had to make was tweaking the u-boot patch to point at board/xilinx/zynq/board.c rather than board/xilinx/common/board.c

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now