XMC4500 LCD and barcodescanner

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hey everyone,

I am still a beginner with microcontrollers, have some questions and I hope to find some support here.
Currently I am working with the XMC4500 Relax Lite Kit and DAVE 4.

First I want to use a barcodescanner that I would like to connect over the USB port via OTG cable. In the datasheet of the Relax Kit OTG is featured, but this post here: https://www.infineonforums.com/threads/4911-XMC45-Relax-Kit-as-USB-host?p=14635 makes me wondering if it still would work? Has anyone an idea for a workaround?

The second thing is that I have some trouble with a "rg1602 v2" LCD. It has an I2C backpack named "ywrobot lcm1602 iic v1", and exept of the background light it isn't working. I use the "I2C_EXAMPLE_XMC45" project and my main.c looks like this:


#include 
#define SLAVE_ADDRESS (0x4E)

uint8_t tx_buffer[64] = { 0b110, 0x1, 0x2, 0x3 };
int main(void)
{
DAVE_STATUS_t init_status;
init_status = DAVE_Init();
if (init_status == DAVE_STATUS_SUCCESS)
{
//Write data to IO EXPANDER
I2C_MASTER_Transmit(&I2C_MASTER_0, true, SLAVE_ADDRESS, tx_buffer, 1,
false);
while (I2C_MASTER_IsTxBusy(&I2C_MASTER_0))
;
I2C_MASTER_Transmit(&I2C_MASTER_0, false, SLAVE_ADDRESS, tx_buffer, 3,
true);
while (I2C_MASTER_IsTxBusy(&I2C_MASTER_0))
;
}
while (1)
{
}
return 0;
}



However the program sticks after the first data transmit in the while loop.

For any suggestions I would be really thankful!
0 Likes
4 Replies
Not applicable
Short update: The problem with the LCD is solved. It was just one resistor, that wasn't connected correctly..

There is still my other question about the barcodescanner left. So, has anybody experience in connecting USB devices to this board?
0 Likes
User12775
Level 5
Level 5
First solution authored First like received
You should use a serial port interface barcode scanner module, which is much easier to use and much faster.
0 Likes
Not applicable
Thanks for your reply.
I forget to mention that I have bougth the scanner already and since i have limited money at my disposal, because the project is for my bachelor thesis.
So, there is no way to run it via USB?
0 Likes
User12775
Level 5
Level 5
First solution authored First like received
Still possible.

I propose two approaches:
1. Disassemble your barcode scanner. To my experience, a USB barcode scanner is usually assembled with two major parts: a serial port scanner(the work unit) and a serial to USB/Keyboard interface. But this approach is only recommendable if you have advanced hardware skill.
2. Treat the USB scanner as a USB Keyboard.
0 Likes