What is the USB Barcode Data Structure? - usb

USB barcodes have a specific data format???
Example Keybord data format (data which coming from keyboard) is 8 bytes ( modifiers,reserved,keycode1..keycode6).

I've had experience with a number of laser and optical barcode readers, and all of the USB-attached devices can be configured to appear as a USB keyboard. Usually, this configuration step entails scanning a manufacturer-provided sheet of "special" barcodes.
If you need more information (i.e. keycodes, etc.), the wikipedia Human interface device points to the HID 1.12 specification.

Related

Is it possible to send jpg files over CANbus

I'm trying to interface a board level USB camera with a STM32 family microcontroller and send the image file to a central computer using CANbus. Just want to know if this is possible/ has been done before and how involved a task it would be.
I worked at a company where we sent live (low-resolution infra-red) video streams over CAN, but towards the end of my time there they shifted towards ethernet.
So it is possible, but certainly not what it is best suited for. The main advantages of CAN are that it is a multi-point, multi-master bus with built in arbitration. It is meant for short packets, typically 8 bytes (CAN FD allows you to increase that).
If your camera is USB, why not just get a USB repeater cable or USB-over-ethernet gateway?
If there is already a CAN network in place that you are piggy-backing onto then you need to consider what impact you will have on the existing traffic.
If you are starting from scratch then of course CAN will work but it would be an odd choice.
Depending on if its CAN or CANFD (Affects the maximum bulk transfer packet size) you have higher level protocol options to packetise your images and send them over canbus like any other block of data.
For just reguarlar CAN your after part of the standard called J1939.21 Data Link Layer, there are public versions of this floating around online, however due to the agreement when purchasing the standard, I am not able to share the specifics from what I have.
Its on pages 27-28 of the 2001 revision.

Does longitude/latitude info come directly from GNSS chip on Android devices?

I'm trying to directly communicate with the GNSS chip on my device and I am not clear whether the RAW GNSS information is coming directly from the GNSS chip or not. I have used the application provided in the link and it seems to read longitude/latitude information.
Is this information directly coming from the GNSS chip? Further, is the GNSS driver enough to extract this information? Or is longitude/latitude info calculated based on GNSS raw data? If it's the latter, how do I calculate longitude/latitude from raw GNSS (a reference would be sufficient)?
Note: I am not interested in very high accuracy location nor am I interested in indoors location retrieval (using Wi-Fi and Carrier services). I want to record the GPS (or Glonass or whatever) and save it as longitude/latitude format.
Apparently, GPS gives the information. I have found a partial answer here. (this is for GPS, it does not include other GNSS chips like Glonass and Galileo).
Apparently, the GPS hardware outputs results following NMEA format. From the page:
GPS is a commonly used constellation of GNSS satellites. GPS hardware typically reports location information as ASCII strings in the NMEA standard format. Each line of data is a comma-separated list of data values known as a sentence. While each GPS module may choose to report different portions of the NMEA protocol, most devices send one or more of the following sentences:
GPGGA (Fix Information): Includes position fix, altitude, timestamp, and satellite metadata.
GPGLL (Geographic Latitude/Longitude): Includes position fix and timestamp.
GPRMC (Recommended Minimum Navigation): Includes position fix, speed, timestamp, and navigation metadata.
Therefore, GPS driver is sufficient to give longitude/latitude information.

Reading from 315MHz / 433MHz Rf reader module with Raspberry Pi GPIO

OK, so I have a 3 pin 315/433MHz rf reader module which I've connected to my raspberry pi 2. 2 pins are for Voltage and ground, and 3rd goes to a GPIO pin configured as input.
I've actually gotten all of this to work just fine. I can read data manually from the GPIO pin just fine, by accessing the file
/sys/class/gpio/gpio23/value
I can even place a car key next to the receiver press a button, and see the values change between 0 and 1.
The problem is that I cannot figure out how to read the clock, so I cannot figure out if there are supposed to be multiple ones or zeros in a row in the data its reading. There doesn't seem to be any time stamp that I can find to see when the last value was read.
How can I properly read the data the module is receiving?
There are two common protocols used for 315/434 MHz radio transmission by hobbyists (that I know of).
Keyfob type remote control devices tend to use Manchester Encoding.
General data transmission using the Virtual Wire protocol (as popular with Arduinos).
My pigpio library has a Python Virtual Wire implementation and C/Python keyfob Manchester Encoding example (for receive and transmit).
your RF reader should be outputting serial data at some known baud rate (check the manual?) assuming you haven't wired it up to the dedicated serial pins you could look at using the pigpio library, more specifically the bit banging serial commands here for python or here for C/C++ or here for pipes
This allows you to use any GPIO pin for reading serial data and the library has bindings for several methods of use as shown in the links above.

Explain why mikroC's PIC18F4550 HID example works

The mikroC compiler has a library for HID (Human Interface Device) USB communication. In the supplied samples, they specify that the buffers below should be in USB RAMand use a PIC18F4550 as the target microcontroller.
unsigned char readbuff[64] absolute 0x500; // Buffers should be in USB RAM, please consult datasheet
unsigned char writebuff[64] absolute 0x540;
But the PIC18F4550's datasheet says USB RAM ranges from 400h to 4FFh.
So why does their example work, when their buffers appear not to be between 400h to 4FFh?
Link to full source.
The datasheet actually says:
Bank 4 (400h through 4FFh) is used specifically for
endpoint buffer control, while Banks 5 through 7 are
available for USB data. Depending on the type of
buffering being used, all but 8 bytes of Bank 4 may also
be available for use as USB buffer space.
So, it would appear the code you're quoting is defining buffers used for USB data, not "endpoing buffer control" since they are in bank 5 instead of bank 4.
When USB HID mode is activated, USB RAM Memory ranges from 400h to 4FFh is assigned for buffer descriptors. Range between 500h and 7ffh is assigned for USB and user data. Important thing is all descriptor buffer and data buffer will be in ram memory range of bank 4-7.
Thank you

SD card interfacing using spi

hi friends
i want to interface SD card using spi.i have no idea on this topic e.g how to initialize,how to work .please help completely about spi SD card interfacing
Thanks
The MMC card and the SD card are flash memory storage based devices, and are physically very similar. Both card types support proprietary data transfer protocols using four data bits, and are compatible though having different initialisation. The major difference is that the SD card is designed to provide optional security by allowing encryption of the device contents. The MMC card supports additional bus widths (up to 8 bits). The SD card also supports several modes that are not present in the MMC card, including SDIO (secure digital input/output) that can be used as an external communications interface using the standard SD card format.
Both card types also support a basic SPI type interface for simple connection to embedded devices. The SD card specifications state a maximum clock frequency of 25MHz, and the MMC specifications state a maximum clock frequency of 52MHz depending on the device. Figure 1 shows the MMC/SD card connections when configured for SPI mode operation.
Here are some useful links on SPI:
Wikipedia help page
Detect SD Card, Read/Write to Card, in VB 2005
writing data to sd card
A pdf on Theories of SD and SPI together
SD Card Specification Details