Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:38 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : USB Keyboard Connection - PIC32MZ

Author Message
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 06:01am 29 Jul 2023
Copy link to clipboard 
Print this post

To date, I have connected conventional PS2 key boards to MicroMite Extremes but now wish to wire up for the USB Keyboard connection.  I am, however, a little confused by the configuration. The datasheet for the PIC32MZ2048 shows:

Pin No.
73 VBUS
74 VUSB3V3
75 VSS
76 D-
77 D+
78 RPF3/USBID/RF3

It is the power voltage issue that confounds me.  PIN73 is 5v tolerant but the rest are not.  USB is usually 5v, but perhaps sometimes USB keyboards can run on 3v3.  Do I simply provide 5v at PIN73 and connect this to the USB connector to the keyboard?  Is level conversion needed for the other pins?  

I don't understand the relationship between pins 73 and 74 ...help please?
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2136
Posted: 08:33am 29 Jul 2023
Copy link to clipboard 
Print this post

If it is like the PIC32MX270 MM2 which uses a USB console, the VBUS pin monitors the USB 5V supply and the VUSB3V3 pin monitors the 3.3V supply to the chip.
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 10:29am 29 Jul 2023
Copy link to clipboard 
Print this post

  phil99 said  If it is like the PIC32MX270 MM2 which uses a USB console, the VBUS pin monitors the USB 5V supply and the VUSB3V3 pin monitors the 3.3V supply to the chip.


I am unaware of a MicroMite based upon the PIC32MX270 which enables a USB keyboard.  Please elaborate?

All I wish to know is which processor pins connect to which USB pins on the PIC32MZ2048 (MicroMite Extreme) chip and where I should feed in 5V for the USB to keyboard connection.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 10:42am 29 Jul 2023
Copy link to clipboard 
Print this post

For the PIC32MZ in host mode (it's actually always running in OTG mode) the VBUS pin must be connected to 5V.
https://microchipdeveloper.com/faq:3233

VUSB3V3 is the 3V3 supply to the on-chip USB module.

Here is an example schematic.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 10:56am 29 Jul 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  For the PIC32MZ in host mode (it's actually always running in OTG mode) the VBUS pin must be connected to 5V.
https://microchipdeveloper.com/faq:3233

VUSB3V3 is the 3V3 supply to the on-chip USB module.
/QUOTE]

Thank you for that; immensely helpful, that is the connection that I suspected was right, but it suggests that the data pins would be operating at 5v - perhaps I do not understand USB properly.  
Where is my thinking incorrect?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 11:35am 29 Jul 2023
Copy link to clipboard 
Print this post

D+ and D- only have a nominal voltage - at about 3V. The voltage has nothing to do with VBUS. The transmitter treats them as a differential pair. They normally have pullups to about 3V6.
https://www.beyondlogic.org/usbnutshell/usb2.shtml
Edited 2023-07-29 21:37 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2136
Posted: 12:14pm 29 Jul 2023
Copy link to clipboard 
Print this post

MX270 MM2 thread It doesn't use USB for a keyboard, it's for the link to the terminal.
However it appears to use the same connections as the MZ.
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 01:22pm 29 Jul 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  D+ and D- only have a nominal voltage - at about 3V. The voltage has nothing to do with VBUS. The transmitter treats them as a differential pair. They normally have pullups to about 3V6.
https://www.beyondlogic.org/usbnutshell/usb2.shtml


Mick, thank you.  After I puzzled over this immediately after my last posting, the concept of "differential pair" clicked - and I grew donkey ears immediately for not remembering how all this works.  

All now clear in my mind and USB keyboard connected up.
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 01:26pm 29 Jul 2023
Copy link to clipboard 
Print this post

  phil99 said  MX270 MM2 thread It doesn't use USB for a keyboard, it's for the link to the terminal.
However it appears to use the same connections as the MZ.


Well, that is a revelation!  This was a thread that I had no knowledge of.  This makes me wonder what other developments are on this forum that have withered into the distance of time.  A fascinating and most interesting innovation.  Thank you for the link.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 01:47pm 29 Jul 2023
Copy link to clipboard 
Print this post

I didn't know about that either (or I'd completely forgotten about it - wouldn't be surprised!), you aren't alone. :)
Edited 2023-07-29 23:47 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 07:32pm 03 Aug 2023
Copy link to clipboard 
Print this post

Well, I have the USB keyboard connected and operating, BUT
with a simple programme running at start-up (OPTION AUTORUN ON), the CTRL-C break does not work and neither does any other key.
OPTION AUTORUN OFF and reboot the system and the keyboard works - all keys okay.  
RUN the programme, CTRL-C functions okay and breaks the programme.  RUN the same programme again and the keyboard is okay.  Run it a third time and the keyboard is dead again.  
Restart with OPTION AUTORUN ON and the keyboard functions not.

All connections are soldered and seem okay, as do the voltage levels.  Problem is repeatable.  When the keyboard is operating it hot-plugs just fine.  

Programme could not be simpler;

DO
LOAD "IMAGE01.BMP"
PAUSE 5000
LOAD "IMAGE02.BMP"
;code repeated to image 10
PAUSE 5000
LOOP


Display is SSD1963

Any ideas welcome...
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2136
Posted: 11:05pm 03 Aug 2023
Copy link to clipboard 
Print this post

Does the MZ have a Library? If so instead of OPTION AUTORUN ON put this sub in it and see what happens. If there is no library adding it to the program may work.

Sub MM.Startup
 Run
End Sub
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 07:20pm 04 Aug 2023
Copy link to clipboard 
Print this post

The problem became more erratic with different scenarios leading me to think that this is not a software/firmware issue.  After various permutations I tracked it down to a marginal 5v supply brought about by the USB cable feeding power to the unit.  When I intercepted the 5V connection to the keyboard USB connection I found that the voltage dropped below 4.5v.  When it was 4.6v all seemed okay.  4.4v and I had keyboard failure.

I concluded that when the programme read from the SD card and the screen was refreshing  the USB power lead was not providing sufficient current and therefore the voltage was dropping below that at which the keyboard would operate.  

Incidentally, I started checking the 5V output on a number of my USB leads and some of the raw voltage drops from a 5V supply were astonishing!  I will have to sort the wheat from the chaff or buy some better USB leads!

Thanks, Phil99, for the suggestion anyhow - and yes, the MZ does have library; one of the reasons I really like the chip.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 07:38pm 04 Aug 2023
Copy link to clipboard 
Print this post

The CMM2 is notorious for drawing enough current to upset typical USB A-B leads. Many of these leads are not designed with any current capability as the 5V supply will normally be present on the remote device (often a printer) as well as the PC. It looks like you've come up against the same problem.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 10:47am 05 Aug 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  The CMM2 is notorious for drawing enough current to upset typical USB A-B leads. Many of these leads are not designed with any current capability as the 5V supply will normally be present on the remote device (often a printer) as well as the PC. It looks like you've come up against the same problem.


Mick, thank you for that additional information - a problem that I had not come across before with less demanding chips/displays.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024