USB Stack Issue still unsolved...

A forum for general AmigaOS 4.x support questions that are not platform-specific
Belxjander
Posts: 316
Joined: Mon May 14, 2012 11:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Re: USB Stack Issue still unsolved...

Post by Belxjander »

I've actually run into this problem myself... however I did find a solution...if this may work for you as well?

The issue is kind of a heisenbug in that it will and will not show as it is technically NOT a bug in either the OS or the HW that I could determine,
My personal workaround was to actually re-order the Kickstart modules in my Sys:Kickstart/KickLayout file and this actually resolved the issue completely.

The major indicator here is entirely that it only *sometimes* happens... the only fault I could determine this to be was a race condition specifically at the time the USB stack modules for the bootkeyboard and bootmouse get launched,
if this is the actual problem or not I can't say for certain, All I know is the KickLayout changes (as following) that I made to my own system appeared to resolve the problem ( apparently due to changing the timings at Kickstart modules being launched at startup )

I don't know if this will have any other subtle effects on the OS itself as I have not run into the USB Keyboard/Mouse issues after changing the KickLayout order.

Belxjander
; $VER: Kicklayout-Sam440ep 53.8 (12.10.2014)
;
LABEL Amiga4.1FE[U1]
EXEC Kickstart/loader
;
MODULE Kickstart/kernel
MODULE Kickstart/bootmenu.kmod
MODULE Kickstart/bootimage
MODULE Kickstart/diskboot.kmod
MODULE Kickstart/diskboot.config
MODULE Kickstart/ramlib.kmod
MODULE Kickstart/shell.kmod
MODULE Kickstart/strap.kmod
;
MODULE Kickstart/battclock.resource.kmod
MODULE Kickstart/biosversion.resource.kmod
MODULE Kickstart/FileSystem.resource.kmod
MODULE Kickstart/i2c.resource.kmod
MODULE Kickstart/nvram.resource.kmod
MODULE Kickstart/fpga.resource.kmod
;
MODULE Kickstart/newlib.library.kmod
MODULE Kickstart/nonvolatile.library.kmod
MODULE Kickstart/keymap.library.kmod
MODULE Kickstart/mounter.library
MODULE Kickstart/dos.library.kmod
MODULE Kickstart/elf.library.kmod
MODULE Kickstart/hunk.library.kmod
MODULE Kickstart/diskcache.library.kmod
MODULE Kickstart/graphics.library.kmod
MODULE Kickstart/intuition.library.kmod
MODULE Kickstart/gadtools.library.kmod
MODULE Kickstart/petunia.library.kmod
MODULE Kickstart/usbresource.library
;
MODULE Kickstart/PCIGraphics.card
MODULE Kickstart/ATIRadeon.chip
MODULE Kickstart/3dfxVoodoo.chip
;
MODULE Kickstart/ramdrive.device.kmod
MODULE Kickstart/keyboard.device.kmod
MODULE Kickstart/input.device.kmod
MODULE Kickstart/console.device.kmod
MODULE Kickstart/timer.device.kmod
MODULE Kickstart/sii0680ide.device.kmod
MODULE Kickstart/sii3114ide.device.kmod
MODULE Kickstart/sii3512ide.device.kmod
MODULE Kickstart/it8212ide.device.kmod
MODULE Kickstart/lsi53c8xx.device.kmod
MODULE Kickstart/usbsys.device
;
MODULE Kickstart/con-handler.kmod
MODULE Kickstart/env-handler.kmod
MODULE Kickstart/ram-handler.kmod
;
MODULE Kickstart/SmartFilesystem
MODULE Kickstart/FastFileSystem
MODULE Kickstart/CDFileSystem
;
MODULE Kickstart/hub.usbfd
MODULE Kickstart/bootmouse.usbfd
MODULE Kickstart/bootkeyboard.usbfd
MODULE Kickstart/massstorage.usbfd
MODULE Kickstart/uhci.usbhcd
MODULE Kickstart/ohci.usbhcd
MODULE Kickstart/ehci.usbhcd
;
graff
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 4
Joined: Thu May 25, 2017 10:14 pm

Re: USB Stack Issue still unsolved...

Post by graff »

@Belxjander
Which modules have you changed the order of?
The kernel modules are loaded to mem and Exec then initializes them in order of their internal hardcoded priority. But, ofcourse, swapping two modules of same priority may have Exec encounter them in a different order since having the same priority there must some other factor ordering the initialization, which *could* be the kicklayout order (I don't know).
So knowing exactly what you changed in the kicklayout may give some vague indication of an area for investigation.

Regards,
Thomas
Belxjander
Posts: 316
Joined: Mon May 14, 2012 11:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Re: USB Stack Issue still unsolved...

Post by Belxjander »

@Belxjander
Which modules have you changed the order of?
The kernel modules are loaded to mem and Exec then initializes them in order of their internal hardcoded priority. But, ofcourse, swapping two modules of same priority may have Exec encounter them in a different order since having the same priority there must some other factor ordering the initialization, which *could* be the kicklayout order (I don't know).
So knowing exactly what you changed in the kicklayout may give some vague indication of an area for investigation.

Regards,
Thomas
Specifically changed from an alphabetical list (as given by the default installation).

Basically I re-arranged on a basis of what modules are in the Kicklayout (order of ROMtag finding and which devices get created dynamically first really)

I did NOT modify any of the Kick Modules themselves on the order in the KickLayout listing.
graff
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 4
Joined: Thu May 25, 2017 10:14 pm

Re: USB Stack Issue still unsolved...

Post by graff »

@Belxjander
Thanks, I'll take note of it and see if it can help point me in a general direction when looking at the attachment issues mentioned in this thread.
The biggest problem for me in finding a cause and fix is probably that I generally don't experience any such problems myself on my SAM460. I have an X5000 on its way (now at the end of my 2nd month of waiting for it to be delivered :roll: ) so maybe I will be able to reproduce some of the problems once it arrives.

Regards,
Thomas
Belxjander
Posts: 316
Joined: Mon May 14, 2012 11:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Re: USB Stack Issue still unsolved...

Post by Belxjander »

by graff » Thu Apr 30, 2020 12:16 am

@Belxjander
Thanks, I'll take note of it and see if it can help point me in a general direction when looking at the attachment issues mentioned in this thread.
The biggest problem for me in finding a cause and fix is probably that I generally don't experience any such problems myself on my SAM460. I have an X5000 on its way (now at the end of my 2nd month of waiting for it to be delivered :roll: ) so maybe I will be able to reproduce some of the problems once it arrives.

Regards,
Thomas
My own system is a SAM 440 Flex with 3 PCI cards ( ATI Radeon 9x00 Graphics, Broadcom Wifi Network and USB3 XHCI controller )

My own USB stack issue is entirely different in that I have a USB3 XHCI controller that the OS can see but ignores,
with a partially written (mostly skeleton) xhci.usbhcd that needs more work to become something actually usable.
Neil_P
Posts: 26
Joined: Sat Jun 18, 2011 2:16 am
Location: Manchester, Britain (United Kingdom)

Re: USB Stack Issue still unsolved...

Post by Neil_P »

UPDATE - my issues have been resolved with a full re-installation of OS4.1FE and Update 1 making the USB issue commented on below - a ghost of my Christmas past. :lol:

Still waiting for a reply from - Belxjander

I've just become the owner of a SAM 440ep-flex OS4.1 FE, update 1 system, with a Radeon 9250 card and 1GB of RAM, but I too seem to be having issues with USB on this system, that's apart from the mouse and keyboard functionality which seems to work acceptably - though using a USB wireless dongle mouse 2.4GHz from the mouse port doesn't seem to work consistently - though it works well on my Windows, Mac and MorphOS systems.

UPDATE - USB now working as expected - so these following comments are left here for reference but do not apply - I get no response or recognition for a Belkin USB 5 port PCI 3.3v/5v card that I fitted in the slot below (towards the edge of the motherboard) the Radeon 9250, as that USB PCI card is not found on the system, which is pitiful as this is one of the most widely used PCI USB cards available, and works a treat in my MorphOS PowerMac G5 system, in fact I have 2 of them in each MorphOS/PowerMac G5 system.

@ Belxjander - I just wondered if you have got any further with your USB3 XHCI controller for use in the SAM 440 as this would be a significant improvement for probably any of the SAM model's capabilities. What make/model is the card specifically, and are you still actively working on its development?

UPDATE - USB now working as expected - so these following comments are left here for reference but do not apply - I cannot even plug in a USB stick/pendrive/flashdrive or SD card adapter in the external slot as I get an "unrecognised" error requester in it, which is really disappointing.

UPDATE - USB now working as expected - so these following comments are left here for reference but do not apply - There does not even seem to be any support for hard drives plugged into the case external USB2 sockets, though I can see my Iomega portable drive is found in the USB Inspector but it is not mounted, and there seems to be no way to get this achieved currently. As there are no USB def_Icons for such devices or USB sticks or SD cards in the Env-archive folder, or even in Storage. In fact, so much so, that I am very disappointed that there is such poor support for USB2 on these boards especially after so long for this to be implemented for Amiga OS4.1 FE. :roll:

@ Belxjander - I will try your USB re-arranging of the k.mods that you have mentioned, though there has been no more updates by graff as to that investigation into this anomaly, and issue and any fix that might be required, or enhancements to the USB2 system/infrastructure for these SAM440 boards. So, it would be great to get an update and observations on this matter so I can implement a fix, and get the darn USB2 system to work as it should do already.

What PCI cards are known to function correctly/work in these PCI slots on the SAM440ep-flex boards? Apart from the Radeon PCI GFX cards! :!:

UPDATE - USB now working as expected - so these following comments are left here for reference but do not apply - I will try to use a USB2 hub in the mouse &/or keyboard ports to allow more functionality with USB2 for the SAM system, but I haven't tried this yet, but will report back here as to what level, if any, of success I get trying this "solution"/bodge! :!:

UPDATE - USB now working as expected - so these following comments are left here for reference but do not apply - Having fitted a Belkin USB 7-port hub on the USB mouse-port on the back of the SAM440ep-flex case/backplate I get the same functionality with the USB mouse I had before I now also get the USB stick recognised in the USB Inspector GUI, but the USB stick does not show up on the Workbench, as the USB Inspector states for Mass-Storage - there is NO DRIVER .... WHAT !! :?:

UPDATE - USB now working as expected - so these following comments are left here for reference but do not apply - Can I fix this in a simple way with some assistance? I know my way around CrossDOS and mounting files, but I don't have a mount file, if that is what I need for the USB stick as such, as there's nothing like that on the system either in DOSDrivers or Storage or even Env-Archive AFAIK !
SAM 440ep-flex 733MHz 1GB RAM, Radeon 9250 PCI, OS4.1FE Upd 1, Amiga A1200 Blizzard SCSi PPC G3 240Mhz/060-50Mhz, 256MB + 200MB -> Radeon 9200 256MB in Mediator TX, + Voodoo 3 3000 16MB, Sound Blaster Live + TT-SOLO-1 soundcards, Spider USB, Ethernet RTL8139 + RTL8029AS, Adaptec 2940UW SCSI.
Belxjander
Posts: 316
Joined: Mon May 14, 2012 11:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Re: USB Stack Issue still unsolved...

Post by Belxjander »

@ Neil_P

Sorry was busy dealing with other things ( I don't spend all that much time online so much... but still have a bouncer for IRC online most of the time),
<-
for the USB3 XHCI controller I have in my sam440, It uses a Renasas(Renesas?) USB3 chip which is PCI to PCIx1 bridged using another chip,
the Bridge chip apparently works as-is using the existing stock sam440 firmware fine ( I worked that out from experimenting within the XHCI usbhcd I've got partially written...)

as for the driver... I'm only really aiming for init and exit handling to be somewhat properly handled... and I lack information as to what exactly is needed for binding the "Root Hub" requirements to the Sirion USB stack properly (working from the documentation... this part to me still has some unexplained questions as to how to "register with the stack"... despite re-reading the documentation again...something still seems missing)

I'm using a separate discussion thread (on this forum) with regards to anyone interested who wants to test any builds,

the first test build should show a few messages care of the Exec DebugPrintF facilities before locking up due to the InterruptHandler still being incomplete.

The first test build I released to testers was mainly to check that the driver can correctly identify and attempt to init XHCI controllers in various machines.

as for availability of the XHCI controller I am using... I literally got lucky when going through Akihabara some 5-7 years ago...
and it has been sitting unused in my sam440 since I got it (I didn't even start any kind of driver skeleton until recently because of other things I need to focus on)
as a side note... I have to separately power the USB3 controller using a molex floppy connector in addition to slot power.
and I'm guessing it is a pre-standard connector card as there is an unknown connector on it for additional USB3 ports which is NOT compatible with the Fractal Design case connector for USB3 ports (I don't recall if it has an additional function or not... it's been a LONG time since I purchased it)

Glad to hear you solved the boot time issue with your USB stack setup...

as for the CrossDOS/NTFS and mount situation... the USB mass storage function driver **requires** to be loaded BEFORE USBHCD drivers are loaded to have automount of attached devices work (no idea why, I *think* there is some internal management thing involved... but that is all I suspect at this time, I have no knowledge of how the internals of the stack work at all...)
/
as for my own system... re-ordering the KickLayout basically solved it for me. maybe I got lucky??

Anyway... I'm needing to change ISPs in the near future and rework the IPv4<->IPv6 situation using the RPi and BBB SBCs I have here
so that I can actually have my sam440 online at all....

Japanese ISPs are actively promoting IPv6 usage alongside "all you can eat FTTH" broadband packages at least in my area in Northern Chiba near Tokyo.

Hrmmm...as for what PCI cards you can use...

My experience has shown me that any "3.3v/5v" Dual-Compatability cards will work for the most part,
the Broadcom Wifi card is in this category along with some IDE and SATA controllers I still have set aside.

I did attempt using a Firewire/IEEE1394 controller card... this FAILED with the machine not even producing a display,,
so "Firewire"(IEEE1394) of any variation can't be connected from what I can tell.
the card I tested was a 5v only card.

as as the sam440 I have is a "flex" motherboard,
I think the "embedded systems" priority dictates that 3.3v operation cards are preferred with compatabily after that.

It may be that 5v only cards are hit-n-miss as to working or not based on how much is installed powered by the system.

Belxjander
Post Reply