Jump to content

an Arduino USB HID controller, composite USB controller


overpro

Recommended Posts

Can anyone help me to send reports from PC to arduino and how i have to modify the firmware??

 

The answer is "it depends", and the full discussion is probably off topic for this thread. Your post contains very little information about your situation (and the term "steering wheel" suggests that you might not even be talking about DCS: World), so I can only give a vague answer. If you have more questions about this, I suggest to start a new thread with more information about what you want to build, what you already have, and what your background in electronics and programming is.

 

The first step to modify any system is to understand how the system works. So start with the blog post linked in the first post of this thread. Understand how the ATMega16U2 and the ATMega2560 controllers work together. Read and understand the code that is running on each controller. Consult the LUFA documentation to learn about USB device descriptors, control endpoints, interrupt endpoints, and other relevant USB internals.

 

Then you would need to modify the code on the ATMega16U2 to accept data over USB (either via the existing HID device or by turning it into a compound device that presents both a HID and a serial port to the PC), and then make it send that data over the serial port to the ATMega328.

 

...or you could just grab an Arduino Nano clone for $3, plug it into a second USB port, and use its built-in USB-to-serial converter (i.e. handle all your outputs on a separate Arduino board).

 

Finally, you need to write software on the host PC that grabs the data you want and sends it to the ATMega16U2 over USB (either using raw HID or a serial port).

Link to comment
Share on other sites

Ian thanks for your response and i'm sorry for not giving you a lot of infos. I'm sorry if my english it's not perfect.

I'm new with Arduino but i understand it easily becouse i've electronics skills and i'm a student in computer science than i've discrete skills on programming, particularly with C/C++.

I wrote here becouse i need the same thing as the joystick firmware do to send HID reports from Arduino to my PC. But i'm building a sterring wheel and i want to add some leds and the force feedback.

Than i've implemented in java an application that retrieve infos from the games that interest me (becouse a self-builded joystick or other will not interact directly with the game) and i want to send that infos to the Arduino with HID4java library. I saw the firmware in this post and it is not implementing this feature. (receive hid reports from the PC) How i can do it? Or there is someone that can help me doing this?

Hope now you've enough infos (you can ask me others if needed) and if a new thread is required i will provide to do it in the right section.

Thanks again.

Link to comment
Share on other sites

Modify the code on the ATMega2560 to read commands from the serial port to control the LEDs.

 

Modify the code on the ATMega16U2 to accept commands via USB control transfers and output the commands over its serial port. This blog post should get you started. Download the LUFA release from the official website and take a look at the included examples as well.

 

Use the HID4java library to send control transfers to the ATMega16U2.

Link to comment
Share on other sites

Thank you Ian for your links; i've read that and searched about what i need.

 

The result is that i've to implement the function

 

 

void CALLBACK_HID_Device_ProcessHIDReport	(
USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo,
const uint8_t 	ReportID,
const uint8_t 	ReportType,
const void * 	ReportData,
const uint16_t 	ReportSize 
)	

 

That is not implemented in darran firmware and into overpro firmware.

 

Somebody have idea how to program this function?

Link to comment
Share on other sites

Searching on internet i think that i've to do something like this:

 

void CALLBACK_HID_Device_ProcessHIDReport	(
USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo,
const uint8_t 	ReportID,
const uint8_t 	ReportType,
const void * 	ReportData,
const uint16_t 	ReportSize 
)

{
uint8_t* Data       = (uint8_t*)ReportData;
}

 

but how i can manage the "Data" variable in the arduino sketches? :helpsmilie:

Link to comment
Share on other sites

  • 1 month later...

hai,

Thanks for the help from Ian & overpro now my gamepad up and running..but how do i change the gamepad name from CVP joystick to example : my joy1?

 

i have 3 gamepad using arduino all the same name

 

how to change it permenantly in linux?..i have installe VM and the required package too

 

thanks

Link to comment
Share on other sites

Problem encounter

 

hello again guys..

 

this time im encounter some button problem..

 

im using the arduino code on post #150 and using CVP joystick with 256btn hex..

 

im testing using SV mapper and realise that button 225,226,227,233,234,235.......255 turn on with out any button push and i dont solder any button to those row/colum...

 

how this happen?..help..

 

please refer attachment provided

asdf.bmp

Link to comment
Share on other sites

firmware compiling failed..need help

 

hello overpro,

 

can you help me about this problem?...i can compile the firmware as it said im missing the cvpjoystick.o file...

\

please refer attachment...thanks overpro..

 

anyone here also can help me pleasee

prob.jpg.dea108dfb28a81d0b7e272946513602d.jpg

Link to comment
Share on other sites

hello overpro,

 

can you help me about this problem?...i can compile the firmware as it said im missing the cvpjoystick.o file...

\

please refer attachment...thanks overpro..

 

anyone here also can help me pleasee

 

Its okey..i have solde the problem..only the placement of LUFA directory

Link to comment
Share on other sites

Here is the firmware for 1HID interface with 256 buttons,

no changes on arduino code, only atmega16u2 firmware has changed.

Please have a try.

 

Cool thingie! :thumbup: Thanks a lot!

 

But I'm looking for another version of the currently available 2x128 and 1x256 Hex-Files:

An 8x32 version for those who are using a flight sim which cannot read DX-buttons above 32 and whose name should not been mentioned here... :music_whistling:

 

As I'm a total noob in screening and changing the code of the Hex-Files (I'm still overexerted with the stock Arduino Code :cry:), hopefully a kind soul will pick up this request...

Link to comment
Share on other sites

Is there a firmware or way to reduce buttons count? I don't want any buttons just axis as I am using my Arduino for rudder peddles

Win10, Intel 3rd Gen. Core i7 3.8Ghz, 20GB ram, Nvidia Geforce 1060 6GB Opentrack (Download it from HERE), PS3 Eye, Saitek x52-pro Joystick,

DIY Rudder Pedals,

Google Cardboard with DCS World

English is not my native language

Link to comment
Share on other sites

Is there a firmware or way to reduce buttons count? I don't want any buttons just axis as I am using my Arduino for rudder peddles

 

yes me too..i hope overpro can help us..i already compile my own firmware using linux...and how to reduce the 2HID into 1 HID with 128button..

 

hoping that overpro help me on this too

Link to comment
Share on other sites

analog input megajoy ?

 

how many input can add to arduino mega 2560 board ?

i need my flight sim

maximum analog input what can use whit usb-hid description.

how made ?

not need buttons and encoders but analog need max.

WHO CAN MADE TO ME ????

i try manytime flip software (not found port)

and try burn new hex, but no can whit my uspasp programmmer

not found port.

who burn to me description were have only max analog input what can adding to mega board ?

i need build own streering wheel and rudder pedals and trottle and trimm wheels and choke,mixture,propel, my cocpit.

i pay little if someone help me and burn mega board and send to me at finland.

paypal have and bank transfer possiple but NO credit card have.

mail me matti point virta at gmail point com if you can made to me arduino board whit max analog input.

please, i have busy need guikly this.

Link to comment
Share on other sites

  • 3 weeks later...
  • 6 months later...

Starting out, first difficulty I'm having is,

 

Download and install flip, you need to make your Mega2560 enter DFU mode: with your mega2560 plugged, just simply shortcut the 2 pins momentarily at here:

 

attachment.php?attachmentid=90985&stc=1&d=1385409173

 

Windows will recognize it as a new device, and you need to manually install the driver by using this file:

The Mega 2560 will not go into DFU mode. I have momentarily connected the two pins as shown, and the Mega 2560 will reset (disappear) as shown in Windows Device Manager, but it will immediately reappear again as an "Arduino 2560 Mega" in Windows Device Manager, and the Arduino IDE. Even so, I'm getting the windows aural annunciation for a new devices connecting, and the LED on the Mega 2560 board does illuminate as shown above.

 

I've verified the "ATMega16U2" chip is installed on the Arduino board.

 

After researching, I found the below post which I suspect is the case.

 

Your Arduino MEGA may have been loaded with the USB Serial firmware and not the combined DFU + USB Serial. To install the DFU firmware you will need an ISP device.

You can get a USBasp from eBay for less than $4 with shipping. It comes with a 10-pin ICSP cable so you will need to buy or make a 6-pin ICSP adapter. You can order one for about another $4.

Post located here Re: Arduino Mega 2560 R3 refuses to enter DFU mode

So, while finding a USBasp with a 10-pin to 6-pin adapter is easy enough, I can't find clear instructions on where to connect the adapter on the Mega 2560 (I suspect the same 6 pin connector as used to reset), and how to upload the "combined DFU + USB Serial" firmware, and where to aquire the firmware (although again, I suspect it's this file located in my Arduino directory,

"E:\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2\Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex".

 

So, could someone please verify my theories.

 

  • The particular Mega2560 (Elegoo, www.elegoo.com) likely did not come with the "combined DFU + USB Serial firmware"?
  • I connect the "10-pin to 6-pin adapter" to the same connection as used to reset/flash, as shown above?
  • The above hex file is correct?

And lastly, how do I flash the "ATMega16U2" chip?

ThankS!!


Edited by DigitalEngine

CPU = Intel i7-6700K

Motherboard = ASUS ROG Maximus VIII Hero Alpha, w/ the Intel Z170 Chipset,

RAM = 64 Gigs of Ripjaws V F4-3400C16Q.

GPU = Zotac GTX980ti Amp Extreme

Hard-drive = Samsung V-NAD SSD 950 PRO M.2

Link to comment
Share on other sites

The post you quoted references using a 6 pin ICSP adapter for the Mega. Look beside the reset button and you will find a 6 pin header labeled ICSP. Thats where the programmer cable is plugged into the Mega. You need to find a data sheet on the Mega so you know what pins do what.

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

The post you quoted references using a 6 pin ICSP adapter for the Mega. Look beside the reset button and you will find a 6 pin header labeled ICSP. Thats where the programmer cable is plugged into the Mega. You need to find a data sheet on the Mega so you know what pins do what.

Thank you Warhog!

This answers question 2 of my previous post.

I should have noticed the ICSP vs JP5 labels for the 2 six pin connectors, sorry my bad!

Please beer with me though, as I'm very much a noob at this...:noexpression: :book:.

 

My next item to find out is the proper connector orientations for the USBISP/6-pin adapter to the Mega ICSP pins, which is what I'm thinking your referring to by needing a data sheet.

I've read that they can be mated 180 degrees out.

 

I have looked at the "official Reference Design PDF" here, which doesn't make it clear, as the individual ICSP pin numbers on the Mega board are not labeled.

https://www.arduino.cc/en/uploads/Main/arduino-mega2560_R3-sch.pdf

 

I have not yet looked at the "Official .brd and .sch files" on the Official Arduino Mega Product page yet, as I'm just discovering about these type of design files, and will need install an app such as KiCad EDA to view these files as I understand it? Which will have to wait a couple of days or so until I get a little more free time. Nor am I sure they will provide the needed data anyway.

 

Here is a picture of the exact particular Mega2560 product I'm dealing with for reference.

 

2-14.jpg

1

CPU = Intel i7-6700K

Motherboard = ASUS ROG Maximus VIII Hero Alpha, w/ the Intel Z170 Chipset,

RAM = 64 Gigs of Ripjaws V F4-3400C16Q.

GPU = Zotac GTX980ti Amp Extreme

Hard-drive = Samsung V-NAD SSD 950 PRO M.2

Link to comment
Share on other sites

  • 2 weeks later...

Reprograming the Mega2560 to flash the USB port.

 

Could someone please verify my assumptions about the proper Arduino Mega2560 ICSP header to the 10-to-6 pin adapter, connection orientation please,

(before I put power to the USBasp + Mega2560).

(reference my previous post above)

 

And now that this

"USBASP USBISP AVR Programmer" is connected, how do I proceed?

Thanks!!

 

 

K1nvGrIPmZ9PVBfw7ZY_e4s59tki2PvnXo3BLLLcshp3i4A9IHWLWRnohnA1WZe2p8hHWxNHh0Q6t2jQG_zXuIahG5LH1baX3SJ9EVJHOqj9TFC8s_uroAYmw9ySHM1jAlHw68SSA94KuEmyGeh9Qd5hhmzrNXKTRdSroHoUqR5are5yEpmr_n4U58lVMnK17kvGrWBP1HlBFHaFBKKXAmlpmy9-sZg8U0vrOAIsKcvzml9nNCpvmvBi1KrcRgjc533sYmY9Grwadps3zzrz9hVyHH6r0hd0lGESa971wIADEu5kaNtkTMg9RtCe_L7YjEZOv9YyQugixwFBKNsJCY_7RrIqDvjBrBKhnXyWj_s8tG4pws6p5C8vYxCWLAvC_EC8nTM7LcVAH1l9z0uiv-MpDeDz3V093luuqr5F8pMUMhxvQcZuLjrbWaBtLm4kNkXwWY-_BezoGzkq4GWqNUv8H0JJiXvNqV7geQxg-hxvnaEpb2CelJZTwZE38s2EqTRzec6gpnCuPOzuJr_cuX84_kkpkHUKmGJNeIPKHn3d6-FF5Pyi-aMOqgeUBMuPKB8DafRUEMD-Zrg6FgxOvgt_8IWWv_bYZMvWUIs6YImVKWzg5xEIZXznxuM_UW346sP2evfyHr3iCnHbQR_6wZjLPDaKdyFHoJqf5lLuww=w1536-h810-no?pageId=112211008554863384975

 

RPUL3fBKIawyTnGVm1DMpg9RqXZ1wqLzJTtWmqyveHhMH9CI6-SBMYhz0sf9j9YxOtOtCtsVXo61rK-kDzCmsRqFW5L31f4gDQXrI2ftveFXQEIt--E1ifTgIGl4OIT6BHWYwNMvfj637oNcuwVp2Ct_krRteMSmBw40ji8gQn49QTCOPKutzXtpxpZwWH59ZEgV-sBi0LMW4rArytjtsRh19R1UPkj0XM08wLysvA42Vz6Dp7pbGmZqJNG30uQDNPOrfRFSDtKj1c2d4AdRQ9_ZUJEmo7jtAc71w7WkxjKBfkujmz9tUpK_k8u9m_CftxvRFn6b8y3T20qLwmf6VrGRnIPHYqatZkVELwO1y1XMHhd-xXY1rcUFILoQH61yoX66oSeADkCL2LObcUmtEIgx94ACZDhGR2MaDGMbRG-ylQ0nAQD8oBfzNBUnb4HcpFA4Tj3tO9-z6-ij51f0OWOEKg1sjTMIk1HdN_DyW10Ci8GHkCVS6qAST_-SAnNyybrGVAq-VMqpg0tYvw_IhychmuuahIJdZYO3f2ZR8cYP7F5Nd3vku30JMihr4Xs6oghjipsat04BF04I5VUtjO-rglXehppluSbVccXtmSjkbTbKEyuRmA1vJ3EIski98nTVy4OPMzwtmyfrS5oBPqlkWBcWUdyuP69H3AQ2pQ=w1618-h910-no?pageId=112211008554863384975

 

2xarr85Ql-IH_OgIprvOm0WO1pmJkRQaIAR3UnB2ltIFXYj1GeByieqAgfypiMmAgU_HpL1VtGu_aSEF469XzxwsIwl8AmLQt5EFakR-JQPAPf98INMzny6onCaGBAylSmbegTm1AULLBFc_15wgbA5Axyq95HV9ikQAjxKKM1gCvzU_9xxYEOX9zaUiF8DW2h6Uc9rOPe_StNLd4vYQoticpo54kC-2sW3hcvQbV-uDH5aU4YGiuf8inFgqL7iHfA4jvu7Pgwv4RtFaPf0RqMSDc02VKua4WQi8fKtJimIUJKFA0edWaWZyMzSxgpRTRtsKHNzSF5j6K9mTeM7zFkhFZyQTlDDLXCkJ1Sy6lcCYBXAzMssW6xT9VCB3rDGNikK0sTekxta8OsOxcZLzHt9MtAsIHQNwQEmrzLHyHr7WAFLJBvcTWFLOo884HAu-t-UODZOTrlnFZenC5yeqbHOkAbSlEAyuansLCky90zHmQlszsafqDXj5meUdLu9kJ4Rq7-HFHuQ9LyQoEyCFDl5T4GD5IL5up3PHIrpynk-q-aWGM58_MtK6ONw7qAR-33RAL_3qQV6N-BgVj-rqLLljZlzdNaOUlFyAHb5ohH0beCPblZCJHJo6DVDb1l_bnORt1UJp821C_LNcSow86RZnWt_ggHY09qkugXJTJw=w1138-h910-no?pageId=112211008554863384975

 

f0VJs2eZE9jJS8mLo73s5sa0oyIdBg9v2nAIq0DhtYnI3Ai1wxRnFudbZ1WxlQ1KF0Mvtcwbtj60vxhIefelHGX2WjJ15W4TjXpioPGMldgYydrebtc-clefJ941MD_KA-0Y7RWFEc3iYOvO66K2yq3a1jUqVZE-krJwgh4vGO3KadkAgweCS7S_rWAAp_AckveiUwDXUcbtfYoEAxEUQ15aWgFMucgTAOhrsB7IoFLSYr7DwR43mL23gu5ezVLj0XZ8nnhbA2UQ15fKGbc25kv-MecTwUPoPs-DO4oDYgt4y_IC43aPCd7O5VUo4wB6bxyjl4ZtdPEA9mVtQ9GYPfoZi-G9ekbTPAWxNzowVxp5b1OTnQpvx2-2KQ-oxFQpkDKht7ST0sYzj8wXlpY6iEzw2sV9jeTz82JNfosNsGWgG2abc5KjPWe1j-QJTUCvtMnIne1o2xUC-DmCIeqXxm1efOLVvkgDdgnS3s0_UVmlSMgsmUFTcNW9OuwaudxmYlXvssxUBFDWpTJl3_JdNF6UZsJrDD0-mONdw4_QZsWmo7UIZTHMeMMWWzwAR9VKoOyNY7KIxTLgd_5I4bAboyTezqHoUjCQSIr0ArEyypjpDVNCt8ii8uX3by5HLfb_LkQLt2JGK4-AsPXrDq512ksOzPm_yNlSQde1e8KYGA=w728-h910-no?pageId=112211008554863384975

apX4JtGcjRbfwJVo8open?id=0B5Z5MiuATXpxLXhkTXBRVUFZWmMview?usp=sharing


Edited by DigitalEngine

CPU = Intel i7-6700K

Motherboard = ASUS ROG Maximus VIII Hero Alpha, w/ the Intel Z170 Chipset,

RAM = 64 Gigs of Ripjaws V F4-3400C16Q.

GPU = Zotac GTX980ti Amp Extreme

Hard-drive = Samsung V-NAD SSD 950 PRO M.2

Link to comment
Share on other sites

This may be of some assistance.

 

https://www.arduino.cc/en/Guide/ArduinoISP#toc3

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

  • 10 months later...
The post you quoted references using a 6 pin ICSP adapter for the Mega. Look beside the reset button and you will find a 6 pin header labeled ICSP. Thats where the programmer cable is plugged into the Mega. You need to find a data sheet on the Mega so you know what pins do what.

 

Sorry Warhog, but I have to correct you on this so no one else makes the same mistake I did.

 

index.php?action=dlattach;topic=125908.0;attach=26850

 

In the image above you need to attach the programmer to the header labelled ICSP for 16U2 NOT ICSP for ATMEGA 2560 which is located next to the reset button. Pin 1 is MISO. This should have been obvious given that the HEX file is named 16U2, but after reading Warhogs post I flashed the 2560 instead. Needless to say my board stopped working.

 

main-qimg-ab53a77a2c5e540093ae75b00ef8d26f

 

This pinout of the programmer will help orientate the connection.

 

Thanks overpro! After straightening out my mess above I now have everything working. I'm looking forward to finally finishing my panels.


Edited by StiC
Link to comment
Share on other sites

Thanks overpro! After straightening out my mess above I now have everything working. I'm looking forward to finally finishing my panels.

 

Congrats to your success!

How did you broke up the big matrix:

Mother/daughter PCBs or floating flat cables or other solution?

Link to comment
Share on other sites

Congrats to your success!

How did you broke up the big matrix:

Mother/daughter PCBs or floating flat cables or other solution?

 

Mother board in the center panel and daughter boards for the 2 side panels. My panels are based on the A-10 so I will distribute the inputs accordingly.

Link to comment
Share on other sites

  • 1 month later...

Hey guys, I know this is somewhat of a dead thread, but I have a question that I hope someone might be able to help me with.

 

I've build a button box using overpro's excellent software and a mega. Everything works, *except* that windows identifies the two devices as a VPC Mongoose. I recently became the owner of the same, and having 3 input devices with the same labeling seems ridiculous. I'm not sure where windows got this idea, but it's pretty resistant to my attempts to change it. I've even gone as far as to reflash the hex file. I assume this is a case of Windows finding a certified driver file that it thinks is a good match, and insisting on using it. Any thoughts?

Link to comment
Share on other sites

So with indrino boards you wire everything in a col/row matrix to get the number of inputs you can achieve. I’m more familiar with the bodnar boards but iirc the most inputs on these boards are 32 to 64 but I may be high there but unlike the Adrinio boards they are plug and play the reason I’m asking I have both boards on hand and although this project doesn’t require the large number of inputs since the space on the button box is limited I may have a hat switch since it is extra from the button inputs the board also has axis inputs for 8 axises iirc I went with the deversived board because of the boards white attachment method otherwise I would use the board I have handy but it requires connectors and my source only had the dual pin connectors with wire I haven’t found any single connectors like you used above.that would be idea if I was able to locate a source for them.

BlackeyCole 20years usaf

XP-11. Dcs 2.5OB

Acer predator laptop/ i7 7720, 2.4ghz, 32 gb ddr4 ram, 500gb ssd,1tb hdd,nvidia 1080 8gb vram

 

 

New FlightSim Blog at https://blackeysblog.wordpress.com. Go visit it and leave me feedback and or comments so I can make it better. A new post every Friday.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...