Tiny Core Base > Raspberry Pi
USB gadget kernel module with RPi zero
bot:
can someone summarize the exact steps in the right sequence to enable the OTG serial access please? I'm fighting with this almost couple of hours without any success. It is so easy in Raspbian...
ladnar:
Sorry, I am new too. I have no advice to give, but was worried that nobody responded yet? Have you tried the Rpi pages? Some of the threads on this forum reference things like SSH and "headless Pi" and OTG and USB Gadget.
My interest is in Pi Brambles, and, specifically, SD-card unmounted Pi zero Brambles. Here are a few other threads that might help.
http://forum.tinycorelinux.net/index.php/topic,21821.0.html
http://forum.tinycorelinux.net/index.php/topic,22341.0.html
http://forum.tinycorelinux.net/index.php/topic,20195.0.html
I think those threads might help, but I am too new to linux (the sum total of my coding ability is "DOS for idiots", "anatomy of hexadecimal JPEGs" and 6502-assembly language) to offer real advice.
ladnar:
Sorry, one link above is THIS PRESENT POST! You've obviously been there/here. I meant to post this other one : http://forum.tinycorelinux.net/index.php/topic,22211.0.html
ladnar:
So, I have managed to (1) purchase 3 QTY raspberry Pi's (12 total QTY, envisioned), (2) purchase one SD card and 2 power supplies, (3) Install PiCore9.0.xsomething?, using?, maybe GParted (GUI) to zero the card and format and partition it, and , $dd if=PiCore-9.0.img of=/dev/sdb to put the image onto the SDcard.
If I remember right, I did not really use GParted to partition; I think just to low-level format. I think the dd command I used is the one that determined the size, and shape, and flavor, and etc. of the partitions, and the "structure" of the file system(s). The vagueness of the above description reveals the extent of my ignorance. In short, so far, much of the process was automatic.
To my surprise, it booted, and I had a command line. The user name and password took a guess or two, because some website I was on told me the wrong info. I think it booted to tc@box:^$ as the username, and I think PiCore was the password. One website told me this was the default, and another said default was no-password? Perhaps the latter was for another version of PiCore and/or tinycore?
Anyhoo, @bot, I am sorry I cannot solve your problem yet, but I might be working on it soon. I will try the Raspbian instructions on my new PiCore machine (Pi Zero) and see if they work. I think I will be trying the Gadget Ethernet, not Gadget Serial, as I do not have the "TTL-USB console wire-thingy", and don't plan on purchasing one just yet.
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/overview
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/serial-gadget
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-tweaks
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/other-modules
@bot, I am, of course, without any ability to offer advice on these pages, as I lack perspective and wisdom in this area.
I am still learning the relevant linux commands, and the one time I had PiCore "fired up", i.e. booted, I couldn't even shut it down or unmount it, for lack of the proper terminology! I think I hacked some solution that PROBABLY wouldn't corrupt the card on shutdown, but I forget since (my handwritten notes inform me) I was working on this back on 11/26/2018.
A couple more days poking around on various linux websites, and I found the relevant commands; (a) shutdown, (b) kill, (c) reset, (d) exit, (e) umount, (f) umount -l [lazy unmount] , (g) eject, (h) ps or pstree, followed by kill , (i) sudo shutdown -r now, (j) sudo reboot, and et cetra, et cetra ... (Also, perhaps, REISUB; How did I not know REISUB? Too many years on a windows computer, I am a Ctrl+Alt+Del man!).
So, the next steps in my plan, are (4) umount -l /dev/sdx , followed by (5) eject /dev/sdx ( I think sdx might be something more like mmcblkx?) . Hopefully this works without a hitch, but I have a feeling I will have to reference the thread : http://forum.tinycorelinux.net/index.php/topic,21821.0.html in order to actually get the thing working properly. (I don't yet understand all this business about "loading extensions" and "creating persistence"; I assume that PiCore loads entirely to RAM, lives there while it is on, and disappears from RAM when the power goes off; leaving the SDcard to give a fresh boot next time? Safe assumption, or must I work to achieve this?).
Next step is to (6) fire up the second Raspberry Pi Zero, and boot PiCore9.0.? to it, (7) repeat above steps to remove the SD card, (8) buy a third power cord (or better yet, a multi-USB power hub module, of some kind), (9) Figure out how to Ethernet gadget them all, except the first one, which, like the mighty Sauron, will be "one USB Host, to rule them all, and in the Pi-ness bind them", and finally, (10) buy 9 more Pi-zeros (with appropriate power supplies and micro-USB-to-micro-USB comm. wires)
OK, that's my plan. @ bot, I hope you are not really a bot, as I have, thus, wasted much time speaking to imaginary things, of imaginary things. But my imagination has made a computer that my mind/hands can't quite build, so, perhaps, the writing of this post will organize my thoughts and make it happen?
ladnar:
So, life intrudes, projects are delayed, but I'm back. This is an extension of my 20 year quest for Strong AI, itself an extension of my investigation of Natural Intelligence, and really only in the last 5 to 8 years have I been trying to organize the "silicon" to get it done right. Previously, I posted some interesting comments on a 6502 forum, back about 2014 or 2015. Those are worth reading, to understand the development of my thought on these topics.
Back in my "retro-6502" days (2014-2015), I was working on my plans for "robot eyes". Those are "still in the works", but, for today, and yesterday, and the next month or two, I will need to start organizing my "robot spinal cord". Namely, USB gadget-ize, 10 R-Pi zeros, and distribute the boards, physically, onto a titanium skeleton (11+ QTY. , 8 mm. diameter, one-foot sections; 8 for limbs; 3 for spine; + miscellaneous? ; motors, "muscles" and "joints" are "in the works"). Originally I was on a very shoestring budget and figured "run clean and light" and thus, picore, RAM-resident (saves money on micro-SDs), but I can probably afford the SD cards now. Still, I was glad to stumble on this old post, and to try to update it with my experience.
Also new to this project, is my dedicated, wall-plug power supply, with some 12 USB "ports" (receptacles), all of them dealing 1 Amp or more, up to 3.5 Amps for some "ports" (receptacles). So, plenty of power. Even if I USB gadgetize the 8 peripheral processors, "the limbs", I will leave them booted and powered from this power supply, and just use the USB gadget function to program--through a 10 "port" (receptacle) USB strip--from the master board to the slaves. Eventually, I will do the "Ohm's Law" math, and get it battery or maybe even solar powered.
I was not sure I knew how to do this; how to gadget-ize while leaving the power supply in place, or if there was some extra programming involved? As it might have been the case that plugging one r-pi zero (gadgetized) into another (non-gadget) would force the non-gadget to power the gadget. The master RPI zero cannot run 10 slave RPI zeros through its USB port; not enough amperage supply. But, luckily, this is not the case, as my USB volt-ammeter confirms. With a series of interesting little experiments I have gotten 2 Raspbian slaves to show up on the network of one Raspbian master, and crucially, they remain powered by my external power supply, not the R-PI zero master-board. I should probably try to see if two raspbian slaves will show up under (ifconfig) one picore master? I bet they would? I should try that today.
So, with the equipment above, and just ping, ifconfig, lsusb, lsblk, and a little bit of knowledge about IPs, I was able to get the 2 boards to show up under ifconfig, as "usb0" and "usb1", with assigned , dynamic IP (IPv4) addresses. I should probably study RNDIS, a bit, as I think that might be the "protocol" that assigns IPs to usb devices? I don't know? I had a few "USB books" by Jan Axelson, but they were too high level to interest me ( I like physics of ones and zeros; bare metal) and too low level to be practical to this project. The advice of johannkraus is JUST RIGHT. Nevermind the books. roll up your sleeves and DO IT!
It probably wouldn't hurt to reassign user-names, hostnames, and passwords, both for my Raspbian SD cards, masters and slaves, and for my piCore masters and slaves. That way IP addresses would be easier? I suppose I could also assign static IP addresses? I know how to do that, but I forgot. Also, with cat /proc/cpuinfo I can take notes on the serial numbers of each device, so that my scientific experiment is more rigorous (meticulous notation!).
Anyhoo, so, last night I stumbled on this post again, and saw--now, with my two years experience in linux CLI--that johannkraus provided excellent instructions; albeit, a bit cross purpose to my own. But his knowledge of rpis and adding modules and of tiny core persistence has helped me, quite a bit, to organize my thoughts and move my programming actions in a positive direction (instead of continued 2 year stagnation).
So last night I (1) found and downloaded modules, (2) unzipped and placed on a flash drive, { (2b) removed flash drive from laptop; booted rpi zero with not-yet-gadget-ized picore 9.0.? ; and plugged flash drive into the rpi zero } ;(3) navigated the CLI of picore (I have v. 9 and v. 11 picore; but no desktop, as of yet) to place the relevant modules in /lib/.../usb , as johannkraus indicated, (4) ran his depmod -a command, even though I don't know what it does, (5) updated .filetool.lst and ran backup, (6) added /sbin/modprobe dwc2 to the onboot.lst , even though I dont know what that does. Presumably, on boot, something "new" will happen?
And then I got tired and fell asleep.
I see, this morning, that I did forget to get the file modules.dep . I wonder if it is a necessary one?
I suppose I should just try plugging the microSD into my laptop, edit the cmdline.txt (or was it cmdline.txt ?) to include dtoverlay=dwc2, and then eject, and then go boot a pi or two, to see if one will be master and one slave? See if ifconfig comes up with more than just a loopback address? comes up with a "usb0" readings; and an IPv4 inet address for it? I could ping it, just for fun!
I also ignored johannkraus' steps about g_multi , since I think this is needed for his mass storage device, whereas, I need g_ether, for my device.
I kinda wish I knew what he meant by this :
"For a working ether over usb I just set up the usb0 interface via ifconfig as described elsewhere in this forum for static eth0."
Any ideas? Anybody? Suggestions?
I think I recall somebody posting (above, somewhere?) that the raspbian instructions to add to cmdline.txt "modules-load=dwc2,g_ether" command doesn't work with picore? hmmm? I'll think about it? Try it?
I have some more steps to figure out this morning, and still have to follow the rest of the thread. Somebody else had trouble getting g_ether to work, but eventual with johannkraus' help--and some perseverence and elbow grease--they got it going.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version