FRDM-MCXN947 and SDK example frdmmcxn947_dev_hid_generic_bm

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-MCXN947 and SDK example frdmmcxn947_dev_hid_generic_bm

853 Views
JohnKay
Contributor II

In hid_generic.c, around line 197, appear the following three (3) lines.

 

USB_DeviceHidSend(g_UsbDeviceHidGeneric.hidHandle, USB_HID_GENERIC_ENDPOINT_IN,

(uint8_t *)&g_UsbDeviceHidGeneric.buffer[g_UsbDeviceHidGeneric.bufferIndex][0],

USB_HID_GENERIC_OUT_BUFFER_LENGTH);

 

g_UsbDeviceHidGeneric.bufferIndex ^= 1U;

 

return USB_DeviceHidRecv(g_UsbDeviceHidGeneric.hidHandle, USB_HID_GENERIC_ENDPOINT_OUT,

(uint8_t *)&g_UsbDeviceHidGeneric.buffer[g_UsbDeviceHidGeneric.bufferIndex][0],

USB_HID_GENERIC_OUT_BUFFER_LENGTH);

 

Using a USB tester on a PC, I am able to <send> a 64 byte packet to the example and

then when I <read> the response, I get the buffer I sent in. Perfect!

 

However, I want to send something else besides the incoming data, I can't get it to

echo anything else.

 

I tried to manually overwrite both buffers, but no dice.

 

memcpy((uint8_t *)&g_UsbDeviceHidGeneric.buffer[0][0],

(uint8_t *)&arg[0], 4);

 

memcpy((uint8_t *)&g_UsbDeviceHidGeneric.buffer[1][0],

(uint8_t *)&arg[0], 4);

 

return USB_DeviceHidRecv(g_UsbDeviceHidGeneric.hidHandle, USB_HID_GENERIC_ENDPOINT_OUT,

(uint8_t *)&g_UsbDeviceHidGeneric.buffer[g_UsbDeviceHidGeneric.bufferIndex][0],

USB_HID_GENERIC_OUT_BUFFER_LENGTH);

 

Any thoughts would be appreciated.

Labels (2)
0 Kudos
Reply
1 Reply

824 Views
Alex_Wang
NXP Employee
NXP Employee

Hi, @JohnKay 

You mentioned "I want to send something else besides the incoming data", can you tell me what something else is?

Best regards, Alex

 

 

0 Kudos
Reply