WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Zero USB gadget  (Read 5073 times)

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Zero USB gadget
« on: May 27, 2017, 07:21:24 PM »
Ok I must have missed something, did a search and tried everything.
Still cannot make a Zero look like anything when plugged into a PC USB port.

Do I need a special USB cable? OTG cable?

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Zero USB gadget
« Reply #1 on: May 28, 2017, 12:43:02 AM »
Been doing some more Zero tinkering.
Got one of these
http://clusterhat.com/faq

According to this I don't need a SDcard for Zero's
https://github.com/raspberrypi/usbboot.
Compiled the code on Linux box and it does see the Zero and downloads start.elf and then it does??????

As PiCore can act as network server, I would like to use PiCore on the host motherboard to boot the Zero's and then serve the OS.
I figured if there is no SDcard in the Zero's when they boot, i cannot make a config/setup/missing file etc mistake ;D

Anyone had any luck with Zero's?
I have tested piCore on Zero's  with camera.



Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1072
Re: Zero USB gadget
« Reply #2 on: May 28, 2017, 07:12:22 AM »
Only the rpi3 can boot without an sdcard.

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

PiCore works just fine booting from USB on a rpi3.   You will probably need to increase waitusb value on the command line. 

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Zero USB gadget
« Reply #3 on: May 28, 2017, 05:52:52 PM »
Only the rpi3 can boot without an sdcard.

Strange becuase it looks like the Zero's are booting and getting files sent to them and the activity led is blinking.
Sometimes I even get the 4 colour square on the monitor.


This is the USB MSD boot code which should work on the Raspberry Pi model A, Compute Module, Compute module 3 and Raspberry Pi Zero.

I actually get a PiBoot drive showing up in Filemanager of my Mint box.
It is recognized, just not working as a MSD.
If it can work as an USB MSD, it should work as any other USB thing as long as the right code is downloaded.




Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1072
Re: Zero USB gadget
« Reply #4 on: May 29, 2017, 05:03:21 AM »
Hmm, I guess it is possible.

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/device.md

That code from github just has the bootloader.  What operating system are you serving to the rpi?

What value is there to boot a rpi attached via USB to a computer?

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Zero USB gadget
« Reply #5 on: May 29, 2017, 06:11:47 AM »
https://ultibo.org/forum/viewtopic.php?f=10&t=333&start=20
https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=184840

Now that I know it works I need to figure out how to do it with piCore.
Cluster Hat is for a camera project, piCore with pi camera works, but why waste SD cards.
Normally i use pikrellcam on Jessie Lite for security cams but it takes ages to install and update/upgrade is stuffed these days  and I would have to do it 4 times.

Been trying to get Lazarus/FPC running TC piCore, command line FPC works, need to make it a tcz.
That should lead to Ultibo on piCore for development, no more Raspbian bloat :P

What value is there to boot a rpi attached via USB to a computer?
Well the USB boot is slower, Ultibo from SD is < 2sec boot.
The advantage is no SD card swapping, faster development etc.

Now that I know it should work I can skip all those crazy/complex instructions on the Cluster Hat pages.
How about using Zero's as RT controller for normal Pi's, no SD, just update run code on boot.

Ultibo kernel.bin so far have been < 3MB for the projects I have done with it.
This is day two for my adventures into Zero coding, before now it has just been write sd and boot.
Give me a few more days and I should think of a few things ;D

Compile rpiboot on Raspbian, copy to piCore.
Wonder if piCore could copy itself to Zero's?






Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Zero USB gadget
« Reply #6 on: July 17, 2017, 04:40:53 AM »
Finally, rpiboot is loading and booting piCore 9.0.3 on a Zero via USB.
Not sure why it works now?

No TCZ partition or folder yet, but kernel is booting.
Kind of cool, no SDcard needed to run piCore on a Zero.

Er a bit hard to plug a keyboard in so it cannot do much.
Time to figure out Ethernet over USB?
If can ssh into the Zero via USB that would be something.

Offline tehfink

  • Newbie
  • *
  • Posts: 11
Re: Zero USB gadget
« Reply #7 on: August 06, 2017, 10:07:06 AM »
Finally, rpiboot is loading and booting piCore 9.0.3 on a Zero via USB.
Not sure why it works now?

No TCZ partition or folder yet, but kernel is booting.
Kind of cool, no SDcard needed to run piCore on a Zero.

Er a bit hard to plug a keyboard in so it cannot do much.
Time to figure out Ethernet over USB?
If can ssh into the Zero via USB that would be something.

Can you post your config? That sounds quite interesting. I was able to ssh into a pi zero configured as a USB Gadget running Raspbian a few months ago, and I'd love to try again with picore:

Raspbian Jessie 2016-05-27 or later, setup the gadget system:
Code: (bash) [Select]
sudo nano /boot/config.txt
dtoverlay=dwc2
sudo nano /boot/cmdline.txt
…rootwait modules-load=dwc2,g_ether
Set a static IP:
Code: (bash) [Select]
sudo nano /etc/network/interfaces
allow-hotplug usb0
iface usb0 inet static
        address 192.168.7.2
        netmask 255.255.255.0
        network 192.168.7.0
        broadcast 192.168.7.255
        gateway 192.168.7.1
Restart the network interfaces (or just reboot):
Code: (bash) [Select]
sudo ifdown usb0
sudo ifup usb0
ifconfig usb0

On the Mac's System Preferences/Network, a new interface should appear: RNDIS. Configure manually to match the settings on the rpi, and now ssh into the Raspberry Pi via USB!

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Zero USB gadget
« Reply #8 on: August 08, 2017, 02:01:40 AM »
Not sure how the Linux overlays and modules work.

Pretty sure to get Ethernet working over the USB port on the Zero some modules need to be loaded.
These are config/cmdline file options which seem to not load or be found with the rpiboot exe.

No problem finding the "boot" folder with picore boot files in it.
sudo rpiboot -d boot works on Linux  Mint.

A Buildroot kernel with the Zero USB modules in the kernel might work easier.
A Zero specific kernel is no problem as this would be for specific purpose not general purpose use like most of my piCore boxes.

Zero's USB booting and Pi3 netbooting piCore would be cool.