![]() |
Forum Index : Microcontroller and PC projects : CMM2: If you want a mouse
Page 1 of 4 ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Get one of these The STM32H7 only supports a single USB device so I can't I/F a USB mouse. Serial and PS2 mice are getting hard to find so I/F a USB mouse. I'm sure there are other options out there but this is tested and works. Also available a a pre-programmed chip (much cheaper) |
||||
JoOngle Regular Member ![]() Joined: 25/07/2020 Location: SwedenPosts: 82 |
Interesting information Peter, (takes notes), this chip could be included on a future PCB. |
||||
Sasquatch![]() Guru ![]() Joined: 08/05/2020 Location: United StatesPosts: 377 |
Thanks for the link! I just ordered 3. I have been looking for something to interface with devices that have a built-in FTDI USB-Serial interface etc. -Carl |
||||
William Leue Guru ![]() Joined: 03/07/2020 Location: United StatesPosts: 405 |
Interesting! Thanks, Peter! -Bill |
||||
elk1984![]() Senior Member ![]() Joined: 11/07/2020 Location: United KingdomPosts: 228 |
Thanks Peter, ordered. I just need to understand where to interface it to get writing something to read it:- https://www.hobbytronics.co.uk/usb-host-mouse Edited 2020-10-06 06:40 by elk1984 |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Hi all, Does this mean we can retain the existing USB keyboard and add a USB joystick (and/or) mouse via something like this? Cheers, Andrew |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
This Does work for a mouse. Bill Edit and here Edited 2020-10-06 08:15 by Turbo46 Keep safe. Live long and prosper. |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Hi Bill, et al, I have just read the SC article and it says I'm not sure about the one that Peter identified? An interesting thought on this device though - the chip is programmed differently depending on whether it is to be used for a mouse or a keyboard - could a jumper, or upfront INPUT, select which variant runs? Again I'm not sure about the one that Peter identified? Cheers, Andrew |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
You can download the C source for each variant so I would expect that they could be combined but that's way beyond me. I posted a demo using that device on the CMM1 here. Bill Keep safe. Live long and prosper. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2640 |
Another USB Host adapter on Banggood site. SPI interface. Mini USB Host Shield 2.0 ADK SLR Development Tool Brand: LILYGO |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
|
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Test code. There does seem to be an issue with the scroll wheel. It works but seems to continue counting unless the mouse moves. I've written to Hobbytronic to ask why initmouse sprite load "mouse.spr",1 do readmouse sprite show 1,x,y,1 text 0,0,str$(x,6,0," ")+str$(y,6,0," ")+str$(lb,2,0," ")+str$(rb,2,0," ")+str$(sb,2,0," ")+str$(xs,4,0," ")+str$(ys,4,0," ")+str$(ss,6,0," ") pause 10 loop ' sub initmouse i2c open 100,1000 i2c write 41,0,3,20,int(mm.hres \ 256),int(mm.hres mod 256) i2c write 41,0,3,22,int(mm.vres \ 256),int(mm.vres mod 256) i2c write 41,0,3,24,int(mm.hres \ 512),int((mm.hres\2) mod 256) i2c write 41,0,3,26,int(mm.vres \ 512),int((mm.vres\2) mod 256) i2c write 41,0,2,28,10 end sub ' sub readmouse do i2c write 41,1,1,0 i2c read 41,0,10,s$ x=str2bin(uint16,left$(s$,2),big) y=str2bin(uint16,mid$(s$,3,2),big) lb=asc(mid$(s$,5,1)) rb=asc(mid$(s$,6,1)) sb=asc(mid$(s$,7,1)) xs=str2bin(int8,mid$(s$,8,1)) ys=str2bin(int8,mid$(s$,9,1)) ss=ss+str2bin(int8,mid$(s$,10,1)) loop until x>=0 and x<MM.hres and y>=0 and y< mm.vres 'trap missreads end sub Mouse.spr 13,1,19 7 77 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 777777 7 7 7 7 77 7 7 7 7 7 77 7 7 7 7 7777 |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
I like the Silicon Chip model from January 2019, but the unit that matherp linked to at the very top of this thread is a nice unit also. The pre-programmed chip in SOIC or SSOP is only US$7 each, which is a pretty sweet-spot price wise. The SSOP and PDIP packages are in stock at Microchip Direct and cost about US$3.50 each, and then you could just upload the firmware to the chip yourself if you wanted to keep the costs to an absolute minimum. The SOIC and QFN packages are out of stock. Very affordable device though. Might have to add some of these to my next order from Microchip Direct. I am particularly interested in the USB 3G Modem version of the firmware, which allows you to take a USB GSM modem stick thing, to simplify sending and receiving text messages. The supported USB modem sticks are about US$20 on eBay or AliExpress, which is half the price of the SimCom modules I am using at the moment, and have to fight them every step of the way to make them work. Might have to get one of those USB sticks in and play with that firmware first! Smoke makes things work. When the smoke gets out, it stops! |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
No you can't. It relies on a pre-programmed bootloader which is copy protected Edited 2020-10-07 01:18 by matherp |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Damn. ![]() Oh well. I just won't order from Microchip Direct then - good to know that ahead of time. I will just get some pre-programmed chips from HT then and be done with it. Quite keen to try out the USB GSM modem one. Smoke makes things work. When the smoke gets out, it stops! |
||||
elk1984![]() Senior Member ![]() Joined: 11/07/2020 Location: United KingdomPosts: 228 |
Great recommendation and Hobbytronics are really fast. Just arrived today! Trouble is, I'm a total wiring newbie. I'm guessing there's different ways of wiring this depending on what protocol you want to read? I'm assuming it doesn't need both 5V and 3.3V power simultaneously. USB Host - CMM2 GPIO 5V - Pin 2 (5V Power) 0V - Pin 6 (Ground) 3V3 - Pin 1 (3.3V Power) SDA / SDI - Pin 3 (I2C SDA) SCL / SCK - Pin 5 (I2C SCK) A / SDO - Pin 12 (PWM 1A) ? SS - ? RX - PIN 10 (COM1 RX) TX - PIN 8 (COM1 RX) |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
You don't need both 5V and 3.3V There is an onboard 3.3V regulator. - Check the supplied schematic. You do need 5V to supply the 5V on the USB connector so use 5V and ignore the 3.3V You use either I2C or Serial. You don't need both and the choice is yours. Serial is easier to start with. Jim VK7JH MMedit |
||||
elk1984![]() Senior Member ![]() Joined: 11/07/2020 Location: United KingdomPosts: 228 |
Thanks Jim. So this one basically? (Reading a schematic isn't something I'm up to - any electronics 101 suggestions welcome) USB Host - CMM2 GPIO 5V - Pin 2 (5V Power) 0V - Pin 6 (Ground) RX - PIN 10 (COM1 RX) TX - PIN 8 (COM1 RX) Edited 2020-10-08 06:50 by elk1984 |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
You need to swap (cross-over) the RX and TX One side transmits to the receiver on the other side. USB Host - CMM2 GPIO 5V - Pin 2 (5V Power) 0V - Pin 6 (Ground) RX - PIN 8 (COM1 TX) TX - PIN 10 (COM1 RX) Jim VK7JH MMedit |
||||
elk1984![]() Senior Member ![]() Joined: 11/07/2020 Location: United KingdomPosts: 228 |
Thanks - doh I did say I'm a total wiring newbie ![]() |
||||
Page 1 of 4 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |