Ok, I've reversed the wires and now it works with what I think is full speed wireless mouse.
But, doesn't work with low speed mouse or keyboard.
Gives that same message as with wires backwards:
GetDescriptor(TYPE_DEVICE): 0x00000000, Retry limit exceeded, transaction canceled.
The USB-SD-uSD thing is fun. It works with a black 2GB card, but not that white 32GB one.
The 64GB Kangaroo doesn't work, probably because it's NTFS.
1GB Lexar JumpDrive works.
4GB RiData doesn't work, not sure why, seems like it should..
Gives this:
<Full-Speed device connected.>Vendor ID: Ut163Product ID: USB2FlashStorage
Version level: 0.00Media is removable
Device does not claim conformance to any SPC standard
Highest LBA: 8060926Sector size: 512Checking media for a FAT file system...
Unable to mount this device.
Here it is. Note: this is a fairly old USB drive, wouldn't worry too much about it...
It's formatted as partition type $06 (FAT16) with a cluster size of 128KB and I currently have the cluster buffer set to a max of 32KB. I did that because FAT32 with 16KB cluster size gets you 64GB+. But since we're testing, I probably should be looking at the extremes, too.
If you want to test it out, you can change the MAX_CLUSTER_SIZE constant to a max of 128KB and the "boms_cluster_buff" buffer size to MAX_CLUSTER_SIZE and it should enumerate.
garryj: Do you have any guidance for using this in an application?
I see I can "type" a file, so know I can get access to a file's contents.
Say I want to open a bmp file and copy contents to RAM.
Is there an easy way to do that?
The TYPE/CAT routine is single-minded, but does show the steps needed to read the directory and access the content of a file. Real fopen() type access is planned, but slow in coming...
How does the read speed compare with usd with spi interface ?
Only needs 2 pins (instead of 4 for uSD). That can be a big advantage...
Did you mean USB vs SPI ?
USB needs 2 COGs I think, but yes, it can run on just 2 pins.
Top USB speeds I've seen from PC's are 8~9 MBit/s (ie the 12 MHz minus overheads), which is slower than P2 can run SPI.
BTW, my head-math sucks -- the cluster size of your RiData drive is 64KB. For what it's worth, this is what MS has to say regarding FAT cluster sizes:
BPB_SecPerClus (BPB offset 13, one byte):
Number of sectors per allocation unit. This value must be a power
of2 that is greater than 0. The legal values are 1, 2, 4, 8, 16, 32, 64,
and128. Note however, that a value should never be used that
results in a “bytes per cluster” value (BPB_BytsPerSec *
BPB_SecPerClus) greater than 32K (32 * 1024). There is a
misconception that values greater than this are OK. Values that
cause a cluster size greater than 32K bytes do not work properly; do
not try to define one. Some versions of some systems allow64K
bytes per cluster value. Many application setup programs will not
work correctly on such a FAT volume.
I'm unable to fully test USB, since PNut doesn't run a terminal by itself after the program has been compiled and loaded. My main problem is that Tera Term resets the board and clears the program after PNut, and thus I'm unable to interact with it. I've tried loading the program with spin2gui as an alternative, but it yields compilation errors.
I'm unable to fully test USB, since PNut doesn't run a terminal by itself after the program has been compiled and loaded. My main problem is that Tera Term resets the board and clears the program after PNut, and thus I'm unable to interact with it. I've tried loading the program with spin2gui as an alternative, but it yields compilation errors.
What version of spin2gui are you using? I'm able to compile that program just fine with versions 3.9.24 and 3.9.26. There is a warning on line 3400 about a cmp being used without flags, but I think that warning is legitimate (and it is just a warning).
I'm unable to fully test USB, since PNut doesn't run a terminal by itself after the program has been compiled and loaded. My main problem is that Tera Term resets the board and clears the program after PNut, and thus I'm unable to interact with it. I've tried loading the program with spin2gui as an alternative, but it yields compilation errors.
What version of spin2gui are you using? I'm able to compile that program just fine with versions 3.9.24 and 3.9.26. There is a warning on line 3400 about a cmp being used without flags, but I think that warning is legitimate (and it is just a warning).
Hi ersmith,
I'm using version 1.3.2, which seems to be much older. I'll upgrade and try the newer version ASAP.
Update: Compilation issue solved with version 3.9.26. Thanks! Now I have to sort out which baudrate is used.
<Full-Speed device connected.>Vendor ID: SanDisk
Product ID: Ultra
Version level: 1.00Media is removable
SCSI version is ANSI X3.131:1994 (SCSI-2) or higher
Highest LBA: 60062499Sector size: 512Checking media for a FAT file system...
Partition type: 0x0C
Cluster size: 16384Volume base sector: 32Reserved sector count: 38FSInfo base sector (in reserved): 33FAT region base sector: 70Sector count of one FAT: 14657FAT region sector count: 29314RootDir base sector: 29384RootDir cluster#: 2Dir/file/data base sector: 29384Count of data region clusters: 1876034Count of free clusters: 1872940FSInfo next free cluster: 52516Count of data region sectors: 60033116Count of volume sectors: 60062468FAT32 volume mounted.
And here is the same test using a SanDisk Cruzer Slice:
<Full-Speed device connected.>Vendor ID: DW
Product ID: PND1GCBM11013B
Version level: 4.00Media is removable
Device does not claim conformance to any SPC standard
Highest LBA: 2045438Sector size: 512Checking media for a FAT file system...
Partition type: 0x0B
Cluster size: 4096Volume base sector: 32Reserved sector count: 36FSInfo base sector (in reserved): 33FAT region base sector: 68Sector count of one FAT: 1994FAT region sector count: 3988RootDir base sector: 4056RootDir cluster#: 2Dir/file/data base sector: 4056Count of data region clusters: 255172Count of free clusters: 252482FSInfo next free cluster: 46608Count of data region sectors: 2041383Count of volume sectors: 2045407FAT32 volume mounted.
The mass storage driver seems to work fine for the most part, although only detects a connection on the upper port of the serial host add-on board. I don't know if it is to be expected.
As for the Cruzer Slice, the pen is formatted and contains no FAT errors. It mounts well on Windows and Linux, so I was not expecting that. The issue is very consistent.
I'm at a loss as to why the lower port is not working, as that is the one I usually test with:
'------------------------------------------------------------------------------' P2-ES USB Host (Master) x 2 Accessory Board I/O group base pin:
USB_BASEPIN = 16' + offsets for ES-64006 Serial Host board'------------------------------------------------------------------------------'#define USB_PORTB
#ifndef USB_PORTB ' PortA is the default.' USB "portA" connector pin assignments (lower port):
HOST_ACTIVE_LED = USB_BASEPIN + 4' USB protection enable/disable
USB_PROTECT_ON = USB_BASEPIN + 5' Smart pin pair used for the USB transceiver:
DM = USB_BASEPIN + 6' DM is "The Brain"
DP = USB_BASEPIN + 7' DP is passive' Long repository pin#:
USB_EVENT_REPO = USB_BASEPIN + 8' LED to blink at host/driver fatal error:
HOST_ERROR_LED = LED56
#else' USB "portB" connector pin assignments (upper port):
HOST_ACTIVE_LED = USB_BASEPIN + 0' USB protection enable/disable
USB_PROTECT_ON = USB_BASEPIN + 1' Smart pin pair used for the USB transceiver:
DM = USB_BASEPIN + 2' DM is "The Brain"
DP = USB_BASEPIN + 3' DP is passive' Long repository pin#:
USB_EVENT_REPO = USB_BASEPIN + 9' LED to blink at host/driver fatal error:
HOST_ERROR_LED = LED57
#endif
There are refreshes (hopefully soon) of the "lite" USB keyboard/mouse demo coming: a pure p2asm version and a Spin2 version, which can support more than one USB port.
Comments
Not really working, but I do get these messages only when I connect a USB device:
<Full-Speed device connected.> GetDescriptor(TYPE_DEVICE): 0x00000000, Retry limit exceeded, transaction canceled.
Maybe I need pullup resistors?
Seems that I have DP on an even pin...
Tried this, but it doesn't work:
DP = 12'27 ' DP is passive DM = 13'26 ' DM is "The Brain"
Time to break out some jumpers...
Yeah. DP must be the odd pin. No pullup/down resistors needed on silicon.
But, doesn't work with low speed mouse or keyboard.
Gives that same message as with wires backwards:
GetDescriptor(TYPE_DEVICE): 0x00000000, Retry limit exceeded, transaction canceled.
This sounds like a great challenge for ersmith!
Fastspin gives a warning on this line:
dreq_clear_endpoint cmp cbw_flags, #BULK_DIR_IN
warning on line 3400 that "cmp" is used without flags being set...
The USB-SD-uSD thing is fun. It works with a black 2GB card, but not that white 32GB one.
The 64GB Kangaroo doesn't work, probably because it's NTFS.
1GB Lexar JumpDrive works.
4GB RiData doesn't work, not sure why, seems like it should..
Gives this:
<Full-Speed device connected.> Vendor ID: Ut163 Product ID: USB2FlashStorage Version level: 0.00 Media is removable Device does not claim conformance to any SPC standard Highest LBA: 8060926 Sector size: 512 Checking media for a FAT file system... Unable to mount this device.
Yep. This routine is called when clearing a stalled endpoint, which is fairly rare. This one's been there a while. Thanks!
Hmm. It's bailing early in the FAT check, so the issue is likely something it doesn't like in the MBR or the volume BPB.
At the "#" start-up prompt, issue a TGLDBG command to enable verbose output and it will output both of these sectors during device enumeration.
<Full-Speed device connected.> GetDescriptor(TYPE_DEVICE): ACK SetAddress(): ACK GetDescriptor(TYPE_DEVICE): ACK GetDescriptor(TYPE_CONFIG): ACK SetConfiguration(): ACK RequestMaxLUN(): ACK INQUIRY(6): 03EF4: 55 53 42 43 6B 85 59 63 24 00 00 00 80 00 06 12 'USBCk.Yc$.......' 03F04: 00 00 00 24 00 00 00 01 00 00 00 00 00 00 00 55 '...$...........U' Data: 04705: 00 80 02 02 1F 00 00 00 55 74 31 36 33 20 20 20 '........Ut163 ' 04715: 55 53 42 32 46 6C 61 73 68 53 74 6F 72 61 67 65 'USB2FlashStorage' 04725: 30 2E 30 30 00 00 00 00 00 00 00 00 00 00 00 00 '0.00............' Status: 03F13: 55 53 42 53 6B 85 59 63 00 00 00 00 00 53 74 61 'USBSk.Yc.....Sta' INQUIRY(6): ACK Vendor ID: Ut163 Product ID: USB2FlashStorage Version level: 0.00 Media is removable Device does not claim conformance to any SPC standard READ CAPACITY(10): 03EF4: 55 53 42 43 C6 A8 A0 E7 08 00 00 00 80 00 0A 25 'USBC...........%' 03F04: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 '...............U' Data: 04804: 00 7A FF FE 00 00 02 00 00 00 00 00 00 00 00 00 '.z..............' Status: 03F13: 55 53 42 53 C6 A8 A0 E7 00 00 00 00 00 53 74 61 'USBS.........Sta' READ CAPACITY(10): ACK Highest LBA: 8060926 Sector size: 512 Checking media for a FAT file system... MBR0 0 1 READ(10): 03EF4: 55 53 42 43 E3 33 2F A3 00 02 00 00 80 00 0A 28 'USBC.3/........(' 03F04: 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 55 '...............U' Data: 04BD4: FA 33 C0 8E D0 BC 00 7C 8B F4 50 07 50 1F FB FC '.3.....|..P.P...' 04BE4: BF 00 06 B9 00 01 F2 A5 EA 1D 06 00 00 BE BE 07 '................' 04BF4: B3 04 80 3C 80 74 0E 80 3C 00 75 1C 83 C6 10 FE '...<.t..<.u.....' 04C04: CB 75 EF CD 18 8B 14 8B 4C 02 8B EE 83 C6 10 FE '.u......L.......' 04C14: CB 74 1A 80 3C 00 74 F4 BE 8B 06 AC 3C 00 74 0B '.t..<.t.....<.t.' 04C24: 56 BB 07 00 B4 0E CD 10 5E EB F0 EB FE BF 05 00 'V.......^.......' 04C34: BB 00 7C B8 01 02 57 CD 13 5F 73 0C 33 C0 CD 13 '..|...W.._s.3...' 04C44: 4F 75 ED BE A3 06 EB D3 BE C2 06 BF FE 7D 81 3D 'Ou...........}.=' 04C54: 55 AA 75 C7 8B F5 EA 00 7C 00 00 49 6E 76 61 6C 'U.u.....|..Inval' 04C64: 69 64 20 70 61 72 74 69 74 69 6F 6E 20 74 61 62 'id partition tab' 04C74: 6C 65 00 45 72 72 6F 72 20 6C 6F 61 64 69 6E 67 'le.Error loading' 04C84: 20 6F 70 65 72 61 74 69 6E 67 20 73 79 73 74 65 ' operating syste' 04C94: 6D 00 4D 69 73 73 69 6E 67 20 6F 70 65 72 61 74 'm.Missing operat' 04CA4: 69 6E 67 20 73 79 73 74 65 6D 00 00 00 00 00 00 'ing system......' 04CB4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04CC4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04CD4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04CE4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04CF4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D04: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D14: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D24: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D34: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D44: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D54: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D64: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D74: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04D84: 00 00 00 00 00 00 00 00 68 A8 A6 B3 00 00 80 01 '........h.......' 04D94: 01 00 06 FE 7F F4 3F 00 00 00 C0 FF 7A 00 00 00 '......?.....z...' 04DA4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04DB4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' 04DC4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA '..............U.' Status: 03F13: 55 53 42 53 E3 33 2F A3 00 00 00 00 00 53 74 61 'USBS.3/......Sta' READ(10): ACK Partition BPB 63 1 READ(10): 03EF4: 55 53 42 43 CB 8A CE 18 00 02 00 00 80 00 0A 28 'USBC...........(' 03F04: 00 00 00 00 3F 00 00 01 00 00 00 00 00 00 00 55 '....?..........U' Data: 04BD4: EB 3C 90 4D 53 44 4F 53 35 2E 30 00 02 80 04 00 '.<.MSDOS5.0.....' 04BE4: 02 00 02 00 00 F8 F6 00 3F 00 FF 00 3F 00 00 00 '........?...?...' 04BF4: C0 FF 7A 00 80 00 29 AB 89 A9 F4 4E 4F 20 4E 41 '..z...)....NO NA' 04C04: 4D 45 20 20 20 20 46 41 54 31 36 20 20 20 33 C9 'ME FAT16 3.' 04C14: 8E D1 BC F0 7B 8E D9 B8 00 20 8E C0 FC BD 00 7C '....{.... .....|' 04C24: 38 4E 24 7D 24 8B C1 99 E8 3C 01 72 1C 83 EB 3A '8N$}$....<.r...:' 04C34: 66 A1 1C 7C 26 66 3B 07 26 8A 57 FC 75 06 80 CA 'f..|&f;.&.W.u...' 04C44: 02 88 56 02 80 C3 10 73 EB 33 C9 8A 46 10 98 F7 '..V....s.3..F...' 04C54: 66 16 03 46 1C 13 56 1E 03 46 0E 13 D1 8B 76 11 'f..F..V..F....v.' 04C64: 60 89 46 FC 89 56 FE B8 20 00 F7 E6 8B 5E 0B 03 '`.F..V.. ....^..' 04C74: C3 48 F7 F3 01 46 FC 11 4E FE 61 BF 00 00 E8 E6 '.H...F..N.a.....' 04C84: 00 72 39 26 38 2D 74 17 60 B1 0B BE A1 7D F3 A6 '.r9&8-t.`....}..' 04C94: 61 74 32 4E 74 09 83 C7 20 3B FB 72 E6 EB DC A0 'at2Nt... ;.r....' 04CA4: FB 7D B4 7D 8B F0 AC 98 40 74 0C 48 74 13 B4 0E '.}.}....@t.Ht...' 04CB4: BB 07 00 CD 10 EB EF A0 FD 7D EB E6 A0 FC 7D EB '.........}....}.' 04CC4: E1 CD 16 CD 19 26 8B 55 1A 52 B0 01 BB 00 00 E8 '.....&.U.R......' 04CD4: 3B 00 72 E8 5B 8A 56 24 BE 0B 7C 8B FC C7 46 F0 ';.r.[.V$..|...F.' 04CE4: 3D 7D C7 46 F4 29 7D 8C D9 89 4E F2 89 4E F6 C6 '=}.F.)}...N..N..' 04CF4: 06 96 7D CB EA 03 00 00 20 0F B6 C8 66 8B 46 F8 '..}..... ...f.F.' 04D04: 66 03 46 1C 66 8B D0 66 C1 EA 10 EB 5E 0F B6 C8 'f.F.f..f....^...' 04D14: 4A 4A 8A 46 0D 32 E4 F7 E2 03 46 FC 13 56 FE EB 'JJ.F.2....F..V..' 04D24: 4A 52 50 06 53 6A 01 6A 10 91 8B 46 18 96 92 33 'JRP.Sj.j...F...3' 04D34: D2 F7 F6 91 F7 F6 42 87 CA F7 76 1A 8A F2 8A E8 '......B...v.....' 04D44: C0 CC 02 0A CC B8 01 02 80 7E 02 0E 75 04 B4 42 '.........~..u..B' 04D54: 8B F4 8A 56 24 CD 13 61 61 72 0B 40 75 01 42 03 '...V$..aar.@u.B.' 04D64: 5E 0B 49 75 06 F8 C3 41 BB 00 00 60 66 6A 00 EB '^.Iu...A...`fj..' 04D74: B0 42 4F 4F 54 4D 47 52 20 20 20 20 0D 0A 52 65 '.BOOTMGR ..Re' 04D84: 6D 6F 76 65 20 64 69 73 6B 73 20 6F 72 20 6F 74 'move disks or ot' 04D94: 68 65 72 20 6D 65 64 69 61 2E FF 0D 0A 44 69 73 'her media....Dis' 04DA4: 6B 20 65 72 72 6F 72 FF 0D 0A 50 72 65 73 73 20 'k error...Press ' 04DB4: 61 6E 79 20 6B 65 79 20 74 6F 20 72 65 73 74 61 'any key to resta' 04DC4: 72 74 0D 0A 00 00 00 00 00 00 00 AC CB D8 55 AA 'rt............U.' Status: 03F13: 55 53 42 53 CB 8A CE 18 00 00 00 00 00 53 74 61 'USBS.........Sta' READ(10): ACK Unable to mount this device. HWStack return address: 00000016
If you want to test it out, you can change the MAX_CLUSTER_SIZE constant to a max of 128KB and the "boms_cluster_buff" buffer size to MAX_CLUSTER_SIZE and it should enumerate.
I see I can "type" a file, so know I can get access to a file's contents.
Say I want to open a bmp file and copy contents to RAM.
Is there an easy way to do that?
The TYPE/CAT routine is single-minded, but does show the steps needed to read the directory and access the content of a file. Real fopen() type access is planned, but slow in coming...
uSD kindof does the same thing.
Thumb drives can be bigger in capacity though.
Harder to break, apparently.
Easier to handle...
Only needs 2 pins (instead of 4 for uSD). That can be a big advantage...
Did you mean USB vs SPI ?
USB needs 2 COGs I think, but yes, it can run on just 2 pins.
Top USB speeds I've seen from PC's are 8~9 MBit/s (ie the 12 MHz minus overheads), which is slower than P2 can run SPI.
BTW, my head-math sucks -- the cluster size of your RiData drive is 64KB. For what it's worth, this is what MS has to say regarding FAT cluster sizes:
BPB_SecPerClus (BPB offset 13, one byte): Number of sectors per allocation unit. This value must be a power of 2 that is greater than 0. The legal values are 1, 2, 4, 8, 16, 32, 64, and 128. Note however, that a value should never be used that results in a “bytes per cluster” value (BPB_BytsPerSec * BPB_SecPerClus) greater than 32K (32 * 1024). There is a misconception that values greater than this are OK. Values that cause a cluster size greater than 32K bytes do not work properly; do not try to define one. Some versions of some systems allow 64K bytes per cluster value. Many application setup programs will not work correctly on such a FAT volume.
I'm unable to fully test USB, since PNut doesn't run a terminal by itself after the program has been compiled and loaded. My main problem is that Tera Term resets the board and clears the program after PNut, and thus I'm unable to interact with it. I've tried loading the program with spin2gui as an alternative, but it yields compilation errors.
I'm using the zip file located in this post:
https://forums.parallax.com/discussion/comment/1462546/#Comment_1462546
Can anyone instruct me on how to run it? Any help would be appreciated. Thanks in advance!
Kind regards, Samuel Lourenço
I'm using version 1.3.2, which seems to be much older. I'll upgrade and try the newer version ASAP.
Update: Compilation issue solved with version 3.9.26. Thanks! Now I have to sort out which baudrate is used.
Kind regards, Samuel Lourenço
Here is what I got with a SanDisk Ultra pen:
<Full-Speed device connected.> Vendor ID: SanDisk Product ID: Ultra Version level: 1.00 Media is removable SCSI version is ANSI X3.131:1994 (SCSI-2) or higher Highest LBA: 60062499 Sector size: 512 Checking media for a FAT file system... Partition type: 0x0C Cluster size: 16384 Volume base sector: 32 Reserved sector count: 38 FSInfo base sector (in reserved): 33 FAT region base sector: 70 Sector count of one FAT: 14657 FAT region sector count: 29314 RootDir base sector: 29384 RootDir cluster#: 2 Dir/file/data base sector: 29384 Count of data region clusters: 1876034 Count of free clusters: 1872940 FSInfo next free cluster: 52516 Count of data region sectors: 60033116 Count of volume sectors: 60062468 FAT32 volume mounted.
And here is the same test using a SanDisk Cruzer Slice:
<Full-Speed device connected.> Vendor ID: SanDisk Product ID: Cruzer Slice Version level: 8.02 Media is removable Device does not claim conformance to any SPC standard No data... Bulk-IN endpoint STALL... SCSI command error: Failed ASC: 0x3A, ASCQ: 0x00 Unit requires attention: medium not present Unable to mount this device.
And a last one with an unidentified, generic pen:
<Full-Speed device connected.> Vendor ID: DW Product ID: PND1GCBM11013B Version level: 4.00 Media is removable Device does not claim conformance to any SPC standard Highest LBA: 2045438 Sector size: 512 Checking media for a FAT file system... Partition type: 0x0B Cluster size: 4096 Volume base sector: 32 Reserved sector count: 36 FSInfo base sector (in reserved): 33 FAT region base sector: 68 Sector count of one FAT: 1994 FAT region sector count: 3988 RootDir base sector: 4056 RootDir cluster#: 2 Dir/file/data base sector: 4056 Count of data region clusters: 255172 Count of free clusters: 252482 FSInfo next free cluster: 46608 Count of data region sectors: 2041383 Count of volume sectors: 2045407 FAT32 volume mounted.
The mass storage driver seems to work fine for the most part, although only detects a connection on the upper port of the serial host add-on board. I don't know if it is to be expected.
As for the Cruzer Slice, the pen is formatted and contains no FAT errors. It mounts well on Windows and Linux, so I was not expecting that. The issue is very consistent.
Kind regards, Samuel Lourenço
Tested the mouse and keyboard driver too, as posted here:
https://forums.parallax.com/discussion/comment/1462633/#Comment_1462633
It works great! First I used a wireless mouse to test it, then a wireless keyboard/mouse combo. Here is the output:
( Entering terminal mode. Press Ctrl-] to exit. ) [2J[HUSB low/full speed minimal host & HID boot protocol keyboard/mouse driver v0.18. Debug output to terminal is off. <Full-Speed device connected.> Woo-hoo, found a boot mouse! Mouse ready... Count: 0000000295, Buttons: 00000000, X: +000, Y: -001 <Device disconnected>. <Low-Speed device connected.> Woo-hoo, found a boot keyboard! Keyboard ready... Woo-hoo, found a boot mouse! Mouse ready... Count: 0000000902, Buttons: 00000000, X: +000, Y: +000defABCDEF
However, as in the MSC driver, only the upper port works on the add-on board.
Kind regards, Samuel Lourenço
'------------------------------------------------------------------------------ ' P2-ES USB Host (Master) x 2 Accessory Board I/O group base pin: USB_BASEPIN = 16 ' + offsets for ES-64006 Serial Host board '------------------------------------------------------------------------------ '#define USB_PORTB #ifndef USB_PORTB ' PortA is the default. ' USB "portA" connector pin assignments (lower port): HOST_ACTIVE_LED = USB_BASEPIN + 4 ' USB protection enable/disable USB_PROTECT_ON = USB_BASEPIN + 5 ' Smart pin pair used for the USB transceiver: DM = USB_BASEPIN + 6 ' DM is "The Brain" DP = USB_BASEPIN + 7 ' DP is passive ' Long repository pin#: USB_EVENT_REPO = USB_BASEPIN + 8 ' LED to blink at host/driver fatal error: HOST_ERROR_LED = LED56 #else ' USB "portB" connector pin assignments (upper port): HOST_ACTIVE_LED = USB_BASEPIN + 0 ' USB protection enable/disable USB_PROTECT_ON = USB_BASEPIN + 1 ' Smart pin pair used for the USB transceiver: DM = USB_BASEPIN + 2 ' DM is "The Brain" DP = USB_BASEPIN + 3 ' DP is passive ' Long repository pin#: USB_EVENT_REPO = USB_BASEPIN + 9 ' LED to blink at host/driver fatal error: HOST_ERROR_LED = LED57 #endif
There are refreshes (hopefully soon) of the "lite" USB keyboard/mouse demo coming: a pure p2asm version and a Spin2 version, which can support more than one USB port.
Hi Samuel,
Just to double check that both power enable pins are getting set; the upper and lower usb sockets each have an ENable pin.
basepin+1 and basepin+5
garryj's post/code above includes those, but maybe some older code didn't assert both?