Sonsivri

Electronics => Projects => Topic started by: EchoRomeo on June 08, 2016, 05:18:36 17:18



Title: USB aviation control panel & other
Post by: EchoRomeo on June 08, 2016, 05:18:36 17:18
Hi there!

My first project on this forums will be as described in the title. I'll write a memory of the project as I go and post here for all to see (full source code, schematics, pictures and comments). Maybe someone will draw inspiration from it.

For now I've got a basic development environment set up, which consists of:

Pickit3 programmer
MPLAB IDE + XC8 PRO compiler
EagleCAD

I'm using the PIC18F4550 as the heart of the project and a shitton of switches, buttons, potentiometers and encoders as input devices. For now I'm focusing on the USB protocol and trying to program a very simple HID-compliant device, just to get the basics straight and out of the way.

Let me know what you guys think of it. If anyone got advice or recommendations, I'm more than glad to hear them!

Cheers,
Daniel

P.S. Kudos to @pickit2 for inviting me to the forum!


Title: Re: USB aviation control panel & other
Post by: koky on June 08, 2016, 06:24:11 18:24
i can't see a link in the "here"
thank you


Title: Re: USB aviation control panel & other
Post by: EchoRomeo on June 12, 2016, 12:44:45 12:44
By "here" I meant in this forums, in this particular thread :)


Title: Re: USB aviation control panel & other
Post by: Gallymimu on June 12, 2016, 11:24:44 23:24
Hi there!

My first project on this forums will be as described in the title. I'll write a memory of the project as I go and post here for all to see (full source code, schematics, pictures and comments). Maybe someone will draw inspiration from it.

For now I've got a basic development environment set up, which consists of:

Pickit3 programmer
MPLAB IDE + XC8 PRO compiler
EagleCAD

I'm using the PIC18F4550 as the heart of the project and a shitton of switches, buttons, potentiometers and encoders as input devices. For now I'm focusing on the USB protocol and trying to program a very simple HID-compliant device, just to get the basics straight and out of the way.

Let me know what you guys think of it. If anyone got advice or recommendations, I'm more than glad to hear them!

Cheers,
Daniel

P.S. Kudos to @pickit2 for inviting me to the forum!


Congrats!  I think this will be a lot more interesting once you actually have done something or have specific questions to ask.

As it stands now I have no idea what you are trying to accomplish!

I am certainly inspired though :)


Title: Re: USB aviation control panel & other
Post by: EchoRomeo on June 13, 2016, 10:34:05 22:34
@Gallymimu, yep you're right. So here goes a couple questions I've encountered during the past few days of research. They all basically relate to operation of the USB subsystem of the PIC18F4550.

So the relevant datasheet says that endpoint Rx/Tx is controlled through the use of buffers described in the corresponding Buffer Descriptor entries (in the BDT). But it doesn't exactly specify, as far as I've found,
  • When responding to an IN token, how to set which DATAx PID will the sent packet use
  • And what exactly must you write to the buffer area (data package only? PID + DATA? PID + DATA + CRC?)

DATAx packet: SOF + PID + DATA + CRC + EOF

Actually, I guess point #1 is a subset of #2. Which is, after describing the buffer starting location and byte count to send, what do you actually write in the buffer? What makes the most sense is that you only write the actual DATA you want to send, since the rest are simple protocol structures which can be generated by the silicon. But it's not really stated anywhere... and I don't have HW USB protocol analyzers, so I can't know what comes out of the PIC. And if you only write the DATA to be sent in the buffer, how do you specify which PID (DATA0/1) should the packet use? The only relevant bits I've found are DTS in the BDSTAT byte of the Buffer Descriptor, but it says very clearly that those bits are ignored when DTSEN = 0, and besides what sense does this make for an IN endpoint? It doesn't have to check the bit, it has to set it.

Code: ("DTSEN bit description")
Data toggle synchronization is enabled; data packets with incorrect Sync value will be ignored except for a SETUP transaction, which is accepted even if the data toggle bits do not match.
Code: ("DTS bit description (note)")
This bit is ignored unless DTSEN = 1.

So, it'd be great if someone who knows can answer this, otherwise I'll try and when I (hopefully) eventually find out I'll update this post with the answer.

Oh by the way, what I'm trying to accomplish is to recreate part of the control dashboard for an aircraft, switches that control subsystem state, operation mode, etc. Also rotary inputs for dials, trim wheels, etc. So it'll be a USB HID-class "joystick" device with a bunch of axis, a bunch of on-off button inputs and that's about it :) If you're curious, you can find general info http://forums.eagle.ru/forumdisplay.php?f=101