Jump to content

STM32 noob questions


wingnut41

Recommended Posts

Hello all, I am completely new to DIY electronics, and I'm looking to take the first baby steps toward my goal of an AV-8B (or maybe a bit of a Frankenstein) home cockpit.

 

My first project is a switch box for the Harrier, built around the STM32. It probably won't be a permanent fixture, just a stepping stone.

 

So far I've played with the STM32 a bit, just doing simple things like blink sketches. Unfortunately I haven't been able to find certain information in the tutorials I've found on youtube. I don't know how to make it show up in windows as a game controller, and once I do that, I'm not sure exactly what libraries I need, exactly what functions work with the STM32, etc.

 

I've looked at FreeJoy but I don't think I need all that, and I'd really like to learn how to do that kind of thing myself, just on a smaller scale for now.

 

I'm using an STM32F103C8T6 and the Arduino IDE because that seemed like it would be the easiest way to get started, with all the tutorials out there. There are just some gaps in my understanding of how to move forward with this project at this point.

 

Any help you all can offer is greatly appreciated.

Link to comment
Share on other sites

Hi i found this webpage thought it might help.

https://opensimhardware.wordpress.com/pedal-button-controller/

https://github.com/OpenSimHardware/PedalButtonController

I am new and learning in electronics most of my stuff has been copy and directed by others. I went the route of MMjoy myself. I was alittle intimidated by the Arduino world cause you have to either write your own sketch or find and copy n paste someone else's sketch. The nice thing about Freejoy or MMjoy it writes the code for you. You just configure your buttons setup in the interface and upload to board. Any way both direction get you too the same destination. Do you have general layout or idea of your project?

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

The STM32duino community is still growing, for now the majority of STM32 users are programming the chip directly without a middle layer bootloader like the Arduino. The whole idea of Arduino is making hardware friendly to software engineers. But so far it's still not equally convenient with STM32 as with AVR. If you can't get the HID sample projects to work, you may need to start programming the chip directly like hardware engineers.

 

ST offers a package of tools. They include free utilities like the following:

ST MCU finder - A parametric list that helps you find the best MCU for your project.

STM32 CubeMX - A graphical design aid utility which lets you configure the chip and generate a complete framework of code based on the libraries you picked.

STM32CubeIDE - A free integrated development environment from ST that allows you to edit, compile, download or debug the chip.

You could also use ST-link or J-link debuggers during your development. They help a lot.

Link to comment
Share on other sites

Maybe I should start over... I have NO idea what I'm doing. I've spent weeks online trying to figure some of this stuff out, but where am I supposed to begin? Where do you learn this stuff?

 

Brewnix, that looks similar to FreeJoy, and honestly, I'm thinking about giving one of those a try... but I don't even know how to do that. I'm not sure what I even need to download from github in order to have something to flash to the controller.

 

Alex, I decided to look into the STM32CubeIDE, maybe playing around with that I can figure out what I need to do. Unfortunately, the link they emailed me is no good, it just gives me a "404, not found."

 

I'm tempted to buy an Arduino board at this point, but while that will help me in the short term, it won't get me very far in the way of learning more about this stuff.

Link to comment
Share on other sites

Ok I completely understand. First have you got a plan as to what buttons, toggles or encoders or potentiometers you are going to use? Second if this is looking to ominous for first time building there are premade boards you can buy that the usb side of things is already done for you just got to wire swtiches to it. Like http://www.leobodnar.com/shop/

These are extremely user friendly. Buy the equipment and plug the wires in and its up and running. No configuring. Plus the community will help.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

I'd also recommend the BU0836 series if your goal is just getting a pit built with certain amount of customized features. But I could feel the itch to try out something new every time someone comes across electronics, and I'd rather encourage people to unlock their potentials.

 

Try not to think about all the big words when starting, coz that's how textbooks bore the crap out of people. It seems like a pure brain job to work with microcontrollers but muscle memory also plays a critical role in the learning curve, especially during the initial stage. Lots of guys freak out when they start reading all the gibberish from datasheets and reference manuals. While they didn't realize it's important to build some confidence by watching youtube tutorials and copy all the moves step by step. Set up the environment, connect the board and debugger, get a flashing LED sample project working, then go back and try to figure out why it worked.

 

USB is further down the line. You may have a thousand questions now but after you get your first couple of sample projects working, you'll be able to ask them in a different way. Fortunately most of the answers are readily available.


Edited by Alex_rcpilot
Link to comment
Share on other sites

I'd also recommend the BU0836 series if your goal is just getting a pit built with certain amount of customized features. But I could feel the itch to try out something new every time someone comes across electronics, and I'd rather encourage people to unlock their potentials.

 

Try not to think about all the big words when starting, coz that's how textbooks bore the crap out of people. It seems like a pure brain job to work with microcontrollers but muscle memory also plays a critical role in the learning curve, especially during the initial stage. Lots of guys freak out when they start reading all the gibberish from datasheets and reference manuals. While they didn't realize it's important to build some confidence by watching youtube tutorials and copy all the moves step by step. Set up the environment, connect the board and debugger, get a flashing LED sample project working, then go back and try to figure out why it worked.

 

USB is further down the line. You may have a thousand questions now but after you get your first couple of sample projects working, you'll be able to ask them in a different way. Fortunately most of the answers are readily available.

 

 

Well said!!

 

 

@Wingnut41. Maybe since you already have a STM32F103C8T6 board maybe first steps are to see if you can find a sketch or use FreeJoy to load a Joystick device on to it. Grab just a couple of toggle switches and try wiring them up. Make sure what ever sketch you load that you have a proper pin out diagram.


Edited by Brewnix

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

I'd rather encourage people to unlock their potentials.
That's what I'm here for :D:smartass:

 

Try not to think about all the big words when starting, coz that's how textbooks bore the crap out of people. It seems like a pure brain job to work with microcontrollers but muscle memory also plays a critical role in the learning curve, especially during the initial stage. Lots of guys freak out when they start reading all the gibberish from datasheets and reference manuals. While they didn't realize it's important to build some confidence by watching youtube tutorials and copy all the moves step by step. Set up the environment, connect the board and debugger, get a flashing LED sample project working, then go back and try to figure out why it worked.

 

USB is further down the line. You may have a thousand questions now but after you get your first couple of sample projects working, you'll be able to ask them in a different way. Fortunately most of the answers are readily available.

The gibberish is certainly overwhelming, I'm trying to only digest what I need to at first. Most of that gibberish is just hardware specs that don't really matter because I've got lots of headroom with a simple project like this. Language and syntax are super easy to learn. I've followed & adapted numerous tutorials & figured out how to use switches & blink LEDs. Personally I try not to reproduce or modify anything until I understand how it works.

 

@Wingnut41. Maybe since you already have a STM32F103C8T6 board maybe first steps are to see if you can find a sketch or use FreeJoy to load a Joystick device on to it.
That's what I've decided to do for now. So, let's get down to specifics. Going off of the tutorial here: https://github.com/FreeJoy-Team/FreeJoyWiki/blob/master/eng/Flashing-firmware-with-USB-UART-converter.md

 

Step 6 says to select the .hex file, but there isn't one. There is a .bin file, so I selected that. I don't think it worked. Windows doesn't recognize it as anything when I plug it in, and it doesn't appear in the game controllers list. FreeJoy configurator also doesn't see it. Any ideas?

 

I appreciate the input from you folks, I feel like I'm getting very close to a usable, finished project, even if it's not exactly my own.

Link to comment
Share on other sites

 

Step 6 says to select the .hex file, but there isn't one. There is a .bin file, so I selected that. I don't think it worked. Windows doesn't recognize it as anything when I plug it in, and it doesn't appear in the game controllers list. FreeJoy configurator also doesn't see it. Any ideas?

 

I appreciate the input from you folks, I feel like I'm getting very close to a usable, finished project, even if it's not exactly my own.

 

 

The .hex is also in the .zip file that you download from Github. Be sure to first erase all that is on the chip. After flashing was completed, I just unplugged the cables and plugged in the usb. Worked like a charm.

 

 

Also in the config util, always start by reading the current config of the board first, then make all your changes (first physical pin config, then the logical button config) and write it to the board.

After you've written the config to your board, unplug it and plug it back in.

i7 8700K water cooled | GTX 1080ti water cooled | 16GB DDR4 3600 | 1TB M.2 | X56 Hotas | Acer VR HMD

Link to comment
Share on other sites

Sokol, thanks for the link, I'm not sure why the .hex was missing from the zip I had downloaded, it was the same release... anyway, I flashed the .hex file & it still doesn't work for me. The LEDs on the serial adapter flash just like they do when I upload any other sketch to the STM32, and with the flashloader you can "verify after download" and it says it has loaded correctly. However, when I disconnect it from the adapter & plug it in on its own, I get nothing.

 

Kea, thanks for responding here. I saw your project & figured I might ask you directly for help, since you did almost exactly what I'm working on.

 

Also in the config util, always start by reading the current config of the board first, then make all your changes (first physical pin config, then the logical button config) and write it to the board.

After you've written the config to your board, unplug it and plug it back in.

I can't read the config from the device, as the config util doesn't recognize that anything is plugged in.

 

It's very unlikely that this is a hardware issue (the board runs other sketches just fine), but I may unwrap another STM32 and give it a try... I'm sure it's user error though. I'll keep tinkering. If you guys have any more insights, I appreciate the feedback.

Link to comment
Share on other sites

I went throught these steps:

 

 

- connected the board with an ST-Link v2 programmer

- opened the ST-Link utility

- target -> connect

- target -> erase

- target -> program (select the .hex, check 'reset after programming')

- wait for it to complete and unplug

- replug and do another target -> connect

- check again if the image is written

- unplug and disconnect the ST-Link programmer

- plug in the micro-usb and connect to the PC

- open the Freejoy Util

 

 

for me that did it. FYI: I've got it running on 1.5.1b4

i7 8700K water cooled | GTX 1080ti water cooled | 16GB DDR4 3600 | 1TB M.2 | X56 Hotas | Acer VR HMD

Link to comment
Share on other sites

I wonder if the serial adapter I bought is incompatible. I'll buy the ST-Link V2 & see if it works with that. I don't see why there would be a difference, but...

 

- target -> connect

- target -> erase

- target -> program (select the .hex, check 'reset after programming')

- wait for it to complete and unplug

- replug and do another target -> connect

- check again if the image is written

This doesn't look familiar... is this a different program? The tutorial that's on github says "Run the program STM32 Flash Loader Demonstrator." This is what I'm using:

https://www.st.com/en/development-tools/flasher-stm32.html

 

 

EDIT: Nevermind about the flasher. I'm looking at the V2 tutorial now.:thumbup:


Edited by wingnut41
Link to comment
Share on other sites

  • Recently Browsing   0 members

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