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!
09-21-2018 06:43 AM
Hi
I wanted to read and write to QSPI flash on my custom board(ZC702), for example storing the log, serial number etc.
Is there any Linux userspace examples to perform read and write to QSPI flash.
Please suggest.
09-24-2018 06:19 AM - edited 09-24-2018 06:30 AM
Hi @umamahesh,
It will be my last message in this thread.
In my opinion you have all you need to do what you what.
I gave you all commands... You have just to code... And it's not our job to do that.
Last tips:
http://www.wiki.xilinx.com/U-Boot+QSPI+Driver
http://www.wiki.xilinx.com/Zynq+QSPI+Driver
http://www.wiki.xilinx.com/Qspi
[EDIT]: In order to close the thread:
#include <mtd/mtd-user.h> .. mtd_info_t mtd_info; .... int fd = open("/dev/mtd0", O_RDWR); // open the mtd device ... lseek... read... write...
Cheers,
Trigger
09-21-2018 07:12 AM
09-21-2018 07:23 AM
Hi Trigger,
I wanted to implement in my code, is there any APIs so that I can read and write to QSPI flash instead of running a command.
For example, from user there may a request to store log in QSPI flash, I need to design the code to store the log.
Please suggest.
09-21-2018 07:29 AM
Hi @umamahesh,
Suggest what ?
We cannot help you if doesn't know exactly what you want to do...
I wanted to implement in my code
C/C++ ? python ? bash ? ...
from user there may a request to store log in QSPI flash
o.0
Cheers,
Trigger
09-21-2018 08:15 AM
Hi trigger,
I have to implement in C. For example I am running a series of test, the results I need to store in QSPI flash.
09-24-2018 01:18 AM
Hi @umamahesh,
We have to know a little bit more about you want else it's to complicated to understand what you want to do ...
QSPI --> Ok
File system ? Y/N
If File system which one ? JFFS2 / UBIFS
Do you have partition(s) ?
So if you want help give us more input :)
Cheers,
Trigger
09-24-2018 01:26 AM
Hi Trigger,
QSPI is enabled, not sure if filesystem is required for jut storing logs and some key code. In case filesystem jffs2 will be preferred.
Not sure on the partitions, y default what has been enabled in the petalinux build will be used.
All I need to know is how to read and write to QSPI flash with some APIs from a userspace C program,
09-24-2018 03:49 AM
Hi @umamahesh,
Depends to what log... Please without more details we cannot help you.
It's really simple, no FS -> search how to read/write block device
FS -> read/write (with file-system) like on a SD-card/eMMC/us stick ...
More info :
Programming QSPI Flash from Linux Console
Linux offers a complete set of utilities to manage the QSPI Flash.
Once the partitions are defined in the Device Tree, they can be listed in Linux using the command 'cat /proc/mtd':
# cat /proc/mtd dev: size erasesize name mtd0: 00800000 00010000 "Flash 0 Raw Data" mtd1: 00800000 00010000 "Flash 1 jffs2 Filesystem"
The following commands are available to manipulate QSPI Flash:
Command Description Usage
flash_erase | Erase flash partition | flash_erase >flash_partition< 0 0 |
flashcp | Copy file to flash partition | flashcp >file_name< >flash_partition< |
mtdinfo | Display flash info | mtdinfo |
mtd_debug info | Display flash info | mtd_debug info <device> |
mtd_debug read | Read flash | mtd_debug read <device> <offset> <len> <dest-filename> |
mtd_debug write | Write flash | mtd_debug write <device> <offset> <len> <source-filename> |
mtd_debug erase | Erase flash | mtd_debug erase <device> <offset> <len> |
PS: Please search a little bit on internet ...
Cheers,
Trigger
09-24-2018 05:55 AM
Hi Trigger,
Your information is acceptable but how to do in programming. For instance the request comes from user to erase flash and store a secret key in QSPI, how will I develop application using the information you have provided.
09-24-2018 06:19 AM - edited 09-24-2018 06:30 AM
Hi @umamahesh,
It will be my last message in this thread.
In my opinion you have all you need to do what you what.
I gave you all commands... You have just to code... And it's not our job to do that.
Last tips:
http://www.wiki.xilinx.com/U-Boot+QSPI+Driver
http://www.wiki.xilinx.com/Zynq+QSPI+Driver
http://www.wiki.xilinx.com/Qspi
[EDIT]: In order to close the thread:
#include <mtd/mtd-user.h> .. mtd_info_t mtd_info; .... int fd = open("/dev/mtd0", O_RDWR); // open the mtd device ... lseek... read... write...
Cheers,
Trigger