Hi Guys - Ive been reading a fair bit on this site and looking at some of the projects that are ongoing. Looks like a great open source project with a big following!
I have an interest in developing hardware predominantly and would like to get a prototyping setup in place to have a go with the software and PC based tool to see what is possible before going all out on a design.
It looks like the STM32F407G-DISC1 eval board could be a good start, my thoughts were to prototype up a basic power stage and some sensors that I can connect to the eval board to see how it all interacts and try out the software and look at how parameterisation would work for custom hardware before getting into a more specific design.
I need to look at the schematic and the pins that are already utilised vs the VESC designs to see if everything that is required is already available as a starting point but wanted to check if this route has been followed before and if there are any hidden gotchas that I should know about sooner rather than later.
Cheers
Harry
I now have a discovery board (STM32F407G-DISC1) and also have a DRV8301 evaluation board on the way (BOOSTXL-DRV8301) so I started looking at the pin out of the discovery versus the pin out of the VESC v4.12 hardware to see what pins needed by the VESC are already committed on the discovery board and if there is a work around on the discovery board.
In short there are a number of clashes in the pinout.
Some that look to be show stoppers:
Some that may be ok left alone for now whilst I am just prototyping:
Hoping that someone can help me out a bit as it looks like I have two options here:
If anyone on here has done this before and can share any tips or highlight any pitfalls I may run into I would really appreciate the input.
Also if this is in the wrong part of the forum let me know so I can move it to the right place.
Cheers,
Harry
Hi Harry. As you said, there are a few showstoppers, so I can anticipate you that the approach of using the 4.12 hardware configuration is not valid (I would not make some of that irreversible modifications to the board). Regarding your question about the precompiled firmware and bootloader, they're available. The bootloader is not hardware-dependent and you can already flash it to the board using the STM32 ST-Link Utility program (I guess you're using Windows, right?). You can download the utility here and the compiled bootloader here. The utility is very straightforward, but tell me if you have issues using it. There are three bootloaders available, I would use "generic.bin" (more on that later).
As you guessed, you must use a custom pin allocation for the board. This doesn't only solve the issues about unavailable pins on the Discovery, but also gives you freedom to allocate the pins according to your needs. For example, I don't like having one pin for UART, I2C and SPI, so instead you can use separate pins. You should allocate all digital pins, even the ones you're not going to use (like Hall or CAN). Just leave them unconnected and disable the corresponding modules in the header files (see CAN_ENABLE as an example). In the case of analog pins, https://vesc-project.com/node/1510 is a good starting point.
My tip is that you first select analog pins and then allocate digital pins. That's because there are far more digital pins, specially in the Discovery board, which is LQFP100 (note that most VESC versions use LQFP64 package, so you might want to use only the pins available on LQFP64 if you want to make your own PCB in the future).
There are three essential documents: the datasheet (see Table 7 and 9), the reference manual (information about registers and under-the-hood details that you might find interesting) and the Discovery user manual. Seems like you already checked that last document. I find Table 6 and Section 7 extremely useful, you are going to use them A LOT.
To sum up, you have to create your own custom configuration. That means creating two files (source and header) in the hwconf folder. I recommend checking all the configurations already available and copy the parts that you need, or modify them (they can be your template). I made a hardware configuration that is "Discovery-ready", I might be able to send it to you.
When your hardware configuration is ready, modify conf_general.h, comment the selected configuration and add your own.
Finally, you have to compile the firmware. Fortunately, there is an easy way to do it on Windows without virtual machines or dual-boot. You can use Windows Subsystem for Linux (WSL), a lightweight shell interface that can run Linux commands. It's like executing Linux without a virtual machine. There are some limitations, but they don't affect this scope. You will need to install some packages: 'make' and 'gcc-arm-none-eabi'. Then, open a WSL command line on the root folder of the project, run 'make' and wait for the firmware to compile. Then, a new folder called 'build' will appear, containing the .bin file you have to flash onto the board (use STM32 ST-Link Utility the first time, then you can use the VESC Tool software, which is faster and less error prone).
I think you already have a lot of information to get started. Tell me about any issues that you have and I'll try to help you.
Hi @javmarina, great response to harrym's questions. It sounds like you got something up and running with a STM32F407 Discovery board, right?
I have this conversation (https://vesc-project.com/node/323) on the forum in mind, where the the consensus is that the VESC code is limited to the STM32F405 when not wanting to rewrite a lot of the code. It looks like the STM32F405 and STM32F407 are very similar (even sharing the same datasheet) with some things like ethernet added to the F407. It would be good to know if one could use a STM32 Discovery board with just the changed hwconf files and all other Chibios related staff etc. untouched. Would be great when you can confirm that it is working for you fine like that on the STM32F407.
Right, as I said in that thread, both F405 and F407 work (they're fairly similar). In fact, all F4xx should work, but have not tested it. Good luck!