Spartan 6, 5V tolerance and PS/2 Keyboard
Spartan 6, 5V tolerance and PS/2 Keyboard
Hi,
I have seen a couple of threads on the ZX Next forums discussing the issue of the Spartan 6 not being 5V tolerant. I noticed a while back the we have 510 ohm resisters on the inputs of the ps/2 keyboard on the ZX Uno and no further level shifting. I measured the the voltages either side of R8 and R10 (on an oscilloscope) and found the following:
Without keyboard:
R8: 3.39V
R10: 3.39V
With Keyboard:
R8: 4.89V
R10: 4.89V
(looked like a square wave several khz )
Is this voltage gradually degrading the Spartan 6? It looks like we need to modify this part of the circuit if it is a problem.
I have seen a couple of threads on the ZX Next forums discussing the issue of the Spartan 6 not being 5V tolerant. I noticed a while back the we have 510 ohm resisters on the inputs of the ps/2 keyboard on the ZX Uno and no further level shifting. I measured the the voltages either side of R8 and R10 (on an oscilloscope) and found the following:
Without keyboard:
R8: 3.39V
R10: 3.39V
With Keyboard:
R8: 4.89V
R10: 4.89V
(looked like a square wave several khz )
Is this voltage gradually degrading the Spartan 6? It looks like we need to modify this part of the circuit if it is a problem.
- mcleod_ideafix
- Mensajes: 831
- Registrado: 27 Sep 2015, 00:14
- Ubicación: Jerez de la Frontera
- Contactar:
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
I will copy my answer from Facebook here:
PS/2 devices connecting to a host are assumed to be open collector, so they either pull the signal to 0V or float. PS/2 pins at the FPGA are internally pulled up to Vccio (3.3V). A proper PS/2 keyboard should not pull up their outputs to 5V, as this is done in the host.
OTOH, the PS/2 input stage for FPGA we use (and I guess Next too) is the same that is commonly used across several dev boards, such as this one:
https://www.pantechsolutions.net/fpga-t ... opment-kit
Or this one:
https://reference.digilentinc.com/_medi ... s2_sch.pdf
PS/2 devices connecting to a host are assumed to be open collector, so they either pull the signal to 0V or float. PS/2 pins at the FPGA are internally pulled up to Vccio (3.3V). A proper PS/2 keyboard should not pull up their outputs to 5V, as this is done in the host.
OTOH, the PS/2 input stage for FPGA we use (and I guess Next too) is the same that is commonly used across several dev boards, such as this one:
https://www.pantechsolutions.net/fpga-t ... opment-kit
Or this one:
https://reference.digilentinc.com/_medi ... s2_sch.pdf
http://www.zxuno.com
ZX-Uno · Clon de ordenador ZX Spectrum basado en FPGA
ZX-Uno · Clon de ordenador ZX Spectrum basado en FPGA
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
No se cómo de común será, pero yo también he observado eso en mis teclados. Aquí hablan de ello, leed las respuestas.mcleod_ideafix escribió:A proper PS/2 keyboard should not pull up their outputs to 5V, as this is done in the host.
"I had the exact same problem. Very helpful, but one thing I couldn't find any info about is whether the KB has its own 5V pull-up resistor. If so, the above design could damage the FPGA. I measured my own PS/2 KB and found that indeed it has a 2.3kΩ pull-up resistor to 5V; therefore if you use a 10kΩ pull-up to 3.3V, the FPGA pin will be exposed to about 4.68V. If you use a 1kΩ pull-up to 3.3V, the FPGA pin will be exposed to about 3.82V (which is under the max of 4.1V). This may be safe, but it's still risky. Unless the capacitor is to stop that; I'm really not sure what it's there for. "
https://electronics.stackexchange.com/q ... -3v-inputs
Y en este otro:
https://eewiki.net/pages/viewpage.actio ... d=28278929
pone lo siguiente:
"The 120Ω series resistors in Figure 1 are required to interface the 3.3V FPGA I/O to the 5V signals."
Por otro lado, aquí comentan algo sobre usar unos trigger Schmitt dependiendo del tipo de teclado (si no usa colector abierto):
https://forums.xilinx.com/t5/Xilinx-Boa ... d-p/173524
P.D. De hecho, parecía el motivo por el cual el core de C64 (entre otros) no funcionaba en Joy2PS2 (basado en arduino, y en el cual respeto por supuesto el funcionamiento adecuado de comunicación 0v o alta impedancia). Resulta que dicho core no tenía las líneas DATA Y CLK en PULLUP y por tanto no funcionaba con Joy2PS2, sin embargo sí lo hacía en teclados físicos convencionales. Eso me dio la pista y tire del hilo hasta observar el mismo comportamiento que comenta Pio, aunque no lo hice público.
viewtopic.php?f=63&t=1507&start=30#p17394
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
Умные люди ставят защитные стабилитроны и не задумываются о проблемах электромиграции
Кстати по выходам VGA так же рекомендуется BAT54S
imho
Кстати по выходам VGA так же рекомендуется BAT54S
imho
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
Thanks for the links, I found a PS/2 module for a wireless keyboard this gave me voltages of 4.69 and 4.35 for R10 and R8(fpga side) respectively.mcleod_ideafix escribió:I will copy my answer from Facebook here:
PS/2 devices connecting to a host are assumed to be open collector, so they either pull the signal to 0V or float. PS/2 pins at the FPGA are internally pulled up to Vccio (3.3V). A proper PS/2 keyboard should not pull up their outputs to 5V, as this is done in the host.
...
I have ordered a couple of PS/2 keyboards one has just a PS/2 plug, the other has a usb plug and a usb to PS/2 converter. If I still have a problem with these I can try modifying them, hopefully.
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
Using the BAT54S tied to 3.3V and ground looks like a good way to protect the Spartan 6 i/o pins.azesmbog escribió:Умные люди ставят защитные стабилитроны и не задумываются о проблемах электромиграции...
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
I have just tested this with a new keyboard CIT KB-2106C, a USB keyboard with USB to PS/2 adapter. It works and the voltages are around 4V, just under. I will use this from now on.
- mcleod_ideafix
- Mensajes: 831
- Registrado: 27 Sep 2015, 00:14
- Ubicación: Jerez de la Frontera
- Contactar:
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
Mmmm... are you sure two zeners is the way to avoid this? 5V Non-tolerant inputs have exactly this stage, with two clamping diodes. OTOH, 5V tolerant inputs have only the lower diode. I recall these zeners are present to limit overshoot and undershoot, but not designed to provide protection against a steady 5V signal.azesmbog escribió:Умные люди ставят защитные стабилитроны и не задумываются о проблемах электромиграции
Кстати по выходам VGA так же рекомендуется BAT54S
imho
I think the simplest solution should have been to provide a jumper to let the user to select 3.3V as power supply for the PS/2 keyboard. Many keyboards allow this.
Anyway.... after all the discussion about this very same matter at the Next forum, I only hope that the current limiting resistor we put on board, along with the pullup resistor that seems to be present inside the keyboard and the internal FPGA pullup to 3.3V, can be enough to minimize the effects of overvoltage at the PS/2 input pins. I use now a keyboard that leaves also about 4V at the clock pin when it's not transmitting a key press.
I promise the next version I design of this will fix this
EDIT: just tested your circuit (in simulator). You sir are absolutely right. It works like a charm, and the BAT54S chip is really tiny. We should have included it! My more sincere apologies
http://www.zxuno.com
ZX-Uno · Clon de ordenador ZX Spectrum basado en FPGA
ZX-Uno · Clon de ordenador ZX Spectrum basado en FPGA
Re: Spartan 6, 5V tolerance and PS/2 Keyboard
Я очень рад, что Вы согласились с моими доводами))
Надеюсь devboard DE1 - достаточно серьезный аргумент для окончательного решения?
http://www.digital-circuitry.com/PDF%20 ... ematic.pdf
Надеюсь devboard DE1 - достаточно серьезный аргумент для окончательного решения?
http://www.digital-circuitry.com/PDF%20 ... ematic.pdf