Post Reply 
The holy grail of the BEEP(1400, 0.08) command: USB-HID
12-23-2021, 03:57 PM (This post was last modified: 12-26-2021 05:01 PM by gehakte_bits.)
Post: #1
The holy grail of the BEEP(1400, 0.08) command: USB-HID
With the latest HP Prime public release (2021 12 02 (14603)) the HP Prime now has another stable trick: the USBOpen(), USBSend() and USBRecv() commands. These commands are used to communicate over an USB connection using the USB-HID protocol.

Besides communicating to sensors, analog<->digital (A/D, D/A) and General Purpose Input/Output (GPIO), there are also many serial interfaces to, for example, test equipment, EEPROM readers/writers, and radio/GPS interfaces. So <then> the retrieved data can be used within the mighty Prime math machine.

To implement an HP Prime USB-HID connection, the goal was to have no other major software development other than on the HP Prime. Although a Raspberry PI/Arduino-like solution might work, the USB-HID interface and its HID device descriptors might be too high of a bar/maintenance for self deployed solutions.

A cheap (<US$20), off-the-shelf solution was found in using the UMFT260EV USB-HID interface. There are other USB-HID converters available, but this one appears to have good documentation/examples.

The HP Prime USB-HID implementation is based on a single endpoint, interrupt only, implementation. Only GET/SET reports are used to communicate on this USB-HID interface.
This limits the configuration of the FT260 to using the default settings only: many settings are done by GET/SET feature reports (unless configured off-line). But the default settings for the I2C interface are all we need! The additional features now lost on the FT260 (GPIO and UART functionality), can be made up by cheap GPIO/UART I2C add-ons.

The UMFT260EV out of the box, no jumper changes, and only HP-PPL, provides access to the I2C interface. This allows access to the EEPROMs, as well as for example sensors and multiple UARTs/GPIOs etc.

Here are some examples of reading sensors, I2C registers, a serial port loopback in single byte as well as FIFO mode.
Finally an HP Prime->USB-HID->I2C->UART->MP3->Speaker will guide us to the holy grail of the BEEP(1400,0.08) command! Hope this will inspire you!

bme680_conf.jpg, bme680.jpg : Reading BME680 Chip id, status, temperature (21 C), pressure (993 mbar), humidity (49%) and gas resistance (20k).
I2Cregs.jpg : Reading the dual UART at I2C address 0x10h, 2 UARTs enabled (reg 0, 0xB3h), reading page 1 (reg 3, 0x01), baud rate 0x05Fh (9600) at reg 0x04~0x06.
UART.jpg : UART2 in loopback (yellow jumper), sending/receiving single char (RX1), or FIFO burst (RXF)

Incl. are example FT260-I2C routines that work on a real Prime:
• UClr() - USB flush rx buffer
• UClose() - USB close
• ft260_open() - open FT260
• ft260_recv() - generic receive (I2C and UART)
• ft260_i2cReadReq() - I2C: full write/read cycle read request
• ft260_i2cSend() - I2C: write data to i2c
• ft260_EEPROMrdall() - read the FT260 EEPROM
• hid2c() - reading/writing to I2C registers

References:
HP Prime G2, HPL Version 14598 or higher required (Many thanks to CyrilleB for the extended help!)
Future Technology Devices UMFT260EV: USB-HID to I2C interface (larger blue circuit board)
Bosch BME680 : I2C Sensor temperature, pressure, humidity and gas detection
DFRobotics DFR0627 : I2C dual UART
Seed Studio MAX232: RS232 level converter (not shown)
(Currently the emulator fails on USBSend(), and it also reports an incorrect HID descriptor size upon USBOpen() commands.)


Attached File(s)
.zip  Prime_ft260_example.zip (Size: 204.49 KB / Downloads: 112)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
The holy grail of the BEEP(1400, 0.08) command: USB-HID - gehakte_bits - 12-23-2021 03:57 PM



User(s) browsing this thread: 1 Guest(s)