05-08-2018 03:06 PM
05-22-2018 10:27 AM
Hi Aravindb,
After many trials and errors, this is what seems to work for me on the Zedboard with Zynq XC7Z020-1CLG484C using 2017.3 petalinux.
Device Tree modification
Kernel menu configuration:
after doing:
>petalinux-build
>petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/spi_design_1_wrapper.bit --pmufw images/linux/u-boot.elf --u-boot
Boot the Petalinux on my Target FPGA.
Then I had to create a disk drive directory:
cd /tmp
mkdir <my_disk_drive>
mount -a -t msdos /tmp/mydev /tm/<my_disk_drive>
Plugged the micro-USB to FPGA target board USB port and the USB Type-A to windows. I see the removable storage drive of 128 megabytes. I formated it and copied files back and forth to it. Now I am in process of writing file operations in C program to create, open, write, read, and close files on both sides of the interfaces (Linux and Windows).
Thanks!
05-09-2018 10:32 PM
Hi ,
You can try below steps for peripheral mode.
2.petalinux-config –c kernel
--> <M> Gadget Filesystem (Change this as M)
Please add below change in this dtsi file: project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi for peripheral mode.
/include/ "system-conf.dtsi"
/ {
};
&usb0 {
status = "okay";
};
&dwc3_0 {
status = "okay";
dr_mode = "peripheral";
};
petalinux-build
petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --fpga images/linux/design_1_wrapper.bit --pmufw images/linux/pmufw.elf --u-boot
Inserting module in sequence:
cd lib/modules/4.9.0-xilinx-v2017.3/
cd kernel/fs/configfs/
modprobe configfs.ko
cd ../..
cd drivers/usb/gadget
modprobe libcomposite.ko
cd function/
insmod usb_f_mass_storage.ko
cd ../legacy/
insmod gadgetfs.ko
dd if=/dev/zero of=/tmp/mydev count=256 bs=1M
insmod g_mass_storage.ko file=/tmp/mydev removable=1
after this step connect the USB male to male cable between target USB port and host USB port, it will detect as a USB drive.
Thanks & regards
Aravind
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
05-10-2018 03:21 PM - edited 05-10-2018 04:11 PM
Hi Aravind,
Thanks for your response:
1. Kernel configuration, I followed your suggestion, but I could not change the
File systems --> Pseudo filesystme -- {M} Userspace-driven configuration filesystem (to M) it is stuck to -*-
-*- Userspace-driven configuration filesystem
No matter what I typeed can't get rid of the -*- and change it to [M].
See image below.
2. Changing the dtsi file in <petalinux_proj>/meta-user/recipes-bsp/device-tree/files/system-user.dtsi gives build errors. Here was the original system-user.dtsi
Here are the suggested change to system-user.dtsi
Petalinux-build gives device tree errors: See image below
I re- modified the system-user.dtsi to this: Let me know if this is okay.
Petalinux-build (based on above system-user.dtsi)
3. petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --fpga images/linux/design_1_wrapper.bit --pmufw images/linux/pmufw.elf --u-boot
Closest match I can think of based on my /images/linux directory files is to do this:
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/tutorial_wrapper.bit --pmufw images/linux/u-boot.elf --u-boot
executing this command:
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/tutorial_wrapper.bit --pmufw images/linux/u-boot.elf --u-boot
I got errors:
ERROR: Invalid arg "--pmufw" for system arch "arm".
So I assumed to change the command to this;
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/tutorial_wrapper.bit --u-boot images/linux/u-boot.elf --u-boot
command worked:
Copied BOOT.BIN and imag.ub to SD card: Now on FPGA Board:
cd /lib/modules/4.9.0-xilinx-v2017.3/kernel/
See below there is no /fs/configfs/ directory
modprobe configsfs.ko does not work: (modprobe: module configfs.ko not foun in moudules.dep)
cd drivers/usb/gadget
modprobe libcomposite.ko (ok)
cd function/
insmod usb_f_mass_storage.ko (ok)
cd ../legacy/
insmod gadgetfs.ko
>gadgetfs: USB Gadget filesystem, version 24 Aug 2004
dd if=/dev/zero of=/tmp/mydev cont=256 bs=1M
insmod g_mass_storage.ko
>udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers
file=/tmp/mydev removable=1
Note:ignore the console word wrap, I think buffer size has an issue that is why the text looks on top of each other.
Now I plugged a Type-A male USB in PC and u-usb in port (J13) that says OTG USB on the Zedboard. Did NOT see any USB enumeration on the PC.
05-20-2018 08:57 AM - edited 05-20-2018 03:14 PM
What is this below device tree modification you suggested in the system-user.dtsi mean?
&dwc3_0 {
status = "okay";
dr_mode = "peripheral";
};
There is no "&dwc3_0" reference in my pcw.dtsi, hence I get petalinux compile errors.
05-22-2018 10:27 AM
Hi Aravindb,
After many trials and errors, this is what seems to work for me on the Zedboard with Zynq XC7Z020-1CLG484C using 2017.3 petalinux.
Device Tree modification
Kernel menu configuration:
after doing:
>petalinux-build
>petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/spi_design_1_wrapper.bit --pmufw images/linux/u-boot.elf --u-boot
Boot the Petalinux on my Target FPGA.
Then I had to create a disk drive directory:
cd /tmp
mkdir <my_disk_drive>
mount -a -t msdos /tmp/mydev /tm/<my_disk_drive>
Plugged the micro-USB to FPGA target board USB port and the USB Type-A to windows. I see the removable storage drive of 128 megabytes. I formated it and copied files back and forth to it. Now I am in process of writing file operations in C program to create, open, write, read, and close files on both sides of the interfaces (Linux and Windows).
Thanks!
07-23-2018 04:44 AM
Hi ! aynilian
I got a same problem with you ! Can you please save me out..., I am using the same device of 7z020 and the same release of petalinux 2017.3.
1) When I run "petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/spi_design_1_wrapper.bit --pmufw images/linux/u-boot.elf --u-boot",
I got a error as "ERROR: Invalid arg "--pmufw" for system arch "arm"."
2)executing the command --"insmod g_mass_storage.ko", got a error as --"udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers"
Thanks !
05-06-2019 05:56 PM - edited 05-06-2019 05:58 PM
Hi,
I am using UZ3EG board, for me g_mass_storage.ko driver is not found.
configuration is attached.
also should I make dts change in &usb0 or &dwc3_0 ? below is my change :
&usb0 {
status = "okay";
};
&dwc3_0 {
status = "okay";
dr_mode = "peripheral";
phy-names = "usb3-phy";
};