2
\$\begingroup\$

I have a game controller. This controller have USB cable and when connected it is instantly recognized by the computer. I wanted to know what it made of so I opened the case and found "STM32F103C8T6" chip. I googled and found : http://datasheetz.com/data/Integrated%20Circuits%20(ICs)/Microcontrollers/497-6063-datasheetz.html

  • At first I thought inside must have a kind of stock "joystick chip" or something but this is actually a general purpose computer. (Probably with custom program loaded in it?) So the ability to interface with computer depends solely on the program loaded in this MCU?

  • Does other computer gadgets (Mouse, Keyboard, MIDI controller, etc.) all have this kind of computer inside?

  • If I wanted to produce a computer goods too, where should I begin to get the complete circuit board in the end? The chip looks like it is not removable from the board and the connection around it is very small. I guess it have to be assembled by precision automatic machine from factory only. (Not the one you can buy separately and assemble like ATMEGA on Arduino. That one is much bigger and you can actually count all the pins with your eye)

  • How can the maker (who? factory?) program into it in the first place?

  • I found several "discovery board" that have this chip and also USB port so you can program into them. So does it means I can also program back into this STM chip on my game controller? Because after all I am using a USB connection to use the controller, and this USB connects to the MCU. I think this same USB should be able to do "using" and "programming".

\$\endgroup\$

closed as too broad by Chris Stratton, duskwuff, Voltage Spike, tcrosley, Sparky256 Jul 20 '16 at 1:20

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Hi! It's great to be interested in these things, but as it stands your question touches vaguely on many topics, without asking a single, specific, answerable question as required by the rules of this site. Many MCUs with on-board USB hardware such as the STM32F103 do exist, and are quite flexible for use in projects. Only a few of the discovery boards have a USB connector attached to the "target" MCU - most only have one attached to the programmer, so even if the target chip supports USB you would have to wire it by hand. Generally TQFP and with care QFN packages can be hand soldered. \$\endgroup\$ – Chris Stratton Jul 19 '16 at 21:59
  • \$\begingroup\$ Any extra circuitry required for a USB-capable microcontroller will be detailed in the datasheet for the microcontroller itself. \$\endgroup\$ – Ignacio Vazquez-Abrams Jul 19 '16 at 22:05
  • \$\begingroup\$ Please see electronics.stackexchange.com/help/on-topic and electronics.stackexchange.com/help/how-to-ask and electronics.stackexchange.com/help/dont-ask for guidelines on how to write questions. \$\endgroup\$ – Voltage Spike Jul 19 '16 at 22:41
5
\$\begingroup\$

Your whole post is a bit broad. But taken separately, each question is answerable in itself, so...

... this is actually a general purpose computer, with custom program loaded in it? So the ability to interface with computer depends solely on the program loaded in this MCU?

In this particular case, you're absolutely right on both points.

Does other computer gadgets (Mouse, Keyboard, MIDI controller, etc.) all have this kind of computer inside?

They all have a controller chip. In some case, it is a generic MCU, like on your specific example here. But in other cases (e.g. high sales volume cheap mouse), it is a specific chip like you first thought it was (and in this case, the chip is not usually documented).

And if I someday wanted to produce a computer goods too, where should I begin to get the complete circuit board in the end? The chip looks like it is not removable from the board and the connection around it is very small.I guess it have to be assembled by precision automatic machine from factory only. (Not the one you can buy separately and assemble like ATMEGA on Arduino. That one is much bigger and you can actually count all the pins with your eye)

The chip you saw (STM32F103C8T6) is a LQFP48. Those have exposed pins, so they are still relatively easy to solder by hand (compared to QFN), even if the pitch is fine. But yes, of course, given the volume, they are assembled using an automated process (pick and place machine, reflow soldering). But even the arduino boards that use DIL are assembled using automated process.

So I am also wondering how can the maker (who? factory?) program into it in the first place.

They do In-Circuit-Programming. They make traces on the PCB that go from the debug pins of the chip to some custom header. Then, during the manufacturing, there is a step where a guy (usually chinese and not paid much - or, for very high volumes again, a machine) puts some cable on this header and there is a computer that then initializes the program code in the microcontroller flash. Sometimes, there isn't even a header, it is just pads on the PCB and they use pogo pins.

I found several "discovery board" that have this chip and also USB port so you can program into them. So does it means I can also program back into this STM chip on my game controller? Because after all I am using a USB connection to use the controller, and this USB connects to the MCU.

Yes, the ST discovery boards (or is it the nucleo boards? - anyway) have a "programming" part and a "demo" part. The demo part contains the MCU to demonstrate and some example peripherals. The programming part contains another chip that makes the bridge from USB to the debugging protocol so you can program ST chips with it. On these boards, you can disable the demo part and connect another board to the programming part. So you could use that to reprogram your game controller. There are also standalone, cheap devices (branded "ST-LINK v2") that can do it. However, you need to identify where on your demo board the debug pins are available (the "custom header" or "exposed pads" I was talking about above).

There could be another solution to reprogram the game controller, which is to take advantage of the bootloader already in ROM. In that case, you don't even need specific additional hardware. You just need to set the BOOT pins of the MCU to the appropriate level (see datasheet - but you also need to identify where is this pin accessible on the PCB) and you should be able to download the new firmware code directly from the game pad USB port itself.

But redeveloping a firmware, even for a game pad, is not a straightforward task. And you'll have to do a lot of reverse engineering on the game pad hardware. It's not impossible, but I wouldn't start with such a challenge.

\$\endgroup\$
2
\$\begingroup\$

This microcontroller is a general purpose microcontroller with some built in USB hardware. It can be program to work like many things. Generally these USB devices use the generic USB Human Interface Device (HID) descriptions, and announce as joystick or gamepad. It's fairly simple. Google USB HID joystick for plenty of examples. Pretty much all OS have drivers for generic USB HID devices.

The IC itself is a QFN or LLP package, surface mount device (SMD). The can and often are soldered by hand, but any mass produce device is done via reflow, a SMD soldering process. Mostly automated.

To program them, a programmer is used before they are soldered on, or they implement test points or breakout a header for In Circuit Serial Program (ICSP). This can also be done as part of the manufacturing process, by automated machines.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.