| Author | beginning argument ( Replies received: 1 ) |
| just_spam_me |
Posted 10-10-2007 at 11:29   |

Registered on : 10-10-2009
Messages : 2
OFF-Line
|
Hello everyones,
I'm currently working on a STR710FZ2 (Embest eval board), and developping a HID application. I started from the updated version of the HID Mouse/Joystick example (sources are from december 2006).
My goal is to send and receive small amounts of data between the PC host (a co-worker is developping the PC softawre), and the MCU.
So I added an endpoint Out (endpoint 2) to the endpoint 1 IN. I changed the report descriptor to identifie my MCU as vendor defined, in order not to move the cursor anymore. I manage to send 2 bytes of data to the PC, as I want. But I have problem getting data from the PC.
My report descriptor ask for 4 bytes. The host PC reads this report with no problem, and the PC seems to send the 4 bytes. I got a CRT interrupt, when I read the counter for endpoint 2 receive I got 4, which is correct. But so far I can't read the PMA correctly.
Of course I'm using the PMAToUserBufferCopy() function. I call it like this : PMAToUserBufferCopy( buffer, ENDP2_RXADDR, 4);
To be sure I write my buffer, I write recognizable stuff (no zeros) inside before. And I have this strange result :
=> buffer[0] and buffer[1] are 0.
=> buffer[2] is correct : I got the value sent by the PC. The 4th value, to be exact.
=> The rest (buffer[3] to buffer[max]) is not written, I found the recognizable values inside.
More amazingly, when I call the function like this : PMAToUserBufferCopy( (buffer+4), ENDP2_RXADDR, 4), I found :
=> buffer[0], buffer[1] and buffer[2] are not written
=> buffer[3], buffer[4] and buffer[5] is 0
=> buffer[6] is correct (same 4th value).
So :
=> First, the PMAtoUser function has a strange 1 byte "offset". It writes the destination buffer 1 byte too "low".
=> Second, Only the last data is correctly read. The other are 0. This result is the same when I ask for 2 datas, I only got the last.
Any thoughts on what might be the problem and how I could solve it would be welcome.
Thanks,
Bruno
PS : by the way, do you know how not to show my email address in public ? It's the best way to end up spammed to death...
|
|
|
Profile
Quote
|
| just_spam_me |
Posted 11-10-2007 at 16:22   |

Registered on : 10-10-2009
Messages : 2
OFF-Line
|
I solved my problem.
The 1-byte offset is still here, but does not bother me, as I just have to add 1 to my pointer.
The zeros where in fact sent by the PC : my HID Report Descriptor was wrong.
The thing I understood was that I must declare a "Usage" value for each field I want to use. Just setting "Report Count" to 4 isn't enough, I have to declare 4 Usage values.
Dawn HID Report...
|
|
|
Profile
Quote
|
|  |
|
|