Skip to main content
Ofer
Associate III
January 28, 2024
Question

HID host USB for getting barcode from a scanner.

  • January 28, 2024
  • 2 replies
  • 2273 views

Hi

I use HID host as USB profile for getting barcode from scanner (ES4650 scanner).

I use STM32F746.

Most of the time I get the right barcode, but sometimes it misses a character .

I tried giving its interrupt the top priority, but it didn't solve the problem.

When trying the same scanner on a PC with a PC software, I always get the right barcode.

What can be the problem ?

Thanks

Ofer

2 replies

AScha.3
Super User
January 28, 2024

Hi,

To check, whether there is a problem with the D-cache (if you have it on) , just switch off (or not enable) the D-cache.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Visitor II
January 28, 2024

Here is an old thread which you can check: https://community.st.com/t5/stm32-mcus-products/barcode-scanner-in-usb-hid/td-p/460686

Here are some barcode reading solutions. Some may become helpful to you.

If you ever try to make an ESPhome based barcode scanner, you can try this:

https://www.pcbway.com/project/shareproject/Barcode_scanner_made_for_ESPHome_bb9bba9a.html

Ofer
OferAuthor
Associate III
February 11, 2024

Dear AScha.3 and liaifat85

Thank for your replies.

I solved this bug.

I uncommented all the 6-7 in my main loop and found that one of them caused the bug.

It was a function that read data from sensors (21 same temperature DS18S20 sensors).

Instead of reading all the 21 sensors every iteration I changed to read only one sensor on each iteration.

Those sensors and the USB are connected to the same 5V power supply.

The sensors which have 1-wire interface need a large pull-up so they probably affect somehow on the USB.

Thanks anyway.