2021-03-02 07:52 AM
Hello, I have a few questions about STM32 microcontrollers:
So ...
In the past I only used Programmable Logic Controllers, with all communications built in, so sorry if my questions are "wrong"
Thanks everyone!
2021-03-03 01:30 AM
That sounds like is going to keep you entertained for a loong time.
The solution most of devices similar to yours came up with is:
Taking the entire HMI out of the stm32 chip, use a UART or USB to connect with a PC running your GUI in c#.
Or you meant your device needs to have an embedded screen?
2021-03-03 04:26 AM
> That sounds like is going to keep you entertained for a loong time.
I second that. Perhaps even an understatement...
Perhaps a Cortex A board, and a Linux-based environment ?
CAN and RS485 are less likely on on eval boards for hobbyist, and more common for industrial usage.
And a nice HMI on smaller MCUs is either complex or resource-consuming, or both.
2021-03-03 05:13 AM
Hello and thank you both for your answers.
I am in the industrial field, I am looking to replace PLCs (which we currently use) to start on the microcontroller type STM or PIC (microchip).
I already have a foot in the latter (I developed applications and cards with ATMega but it was much easier thanks to the arduino community behind)
The goal is to create a card with a microcontroller capable of communicating with equipment (I/O, RS485, CAN, ...) and to have an HMI under visual studio. And therefore to communicate with this HMI (data exchange) why not in Modbus.
This system makes it possible to have a remote HMI capable of updating itself and of retrieving the microcontroller update file in order to program the latter transparently.
I don't know if STM or microchip is the best to do this (I think it's the same)
2021-03-03 07:20 AM
1. Make your own card(s).
1a. Start with a demo board (Nucleo...) and maybe a breadboard. The ST demos have headers so easy to jumper to a breadboard circuits like DIP RS-485 driver ICs.
1b. With STM32 ensure select IC with RS-485 DE signal (Not STM32F4, we use STM32L4 and STM32H7 for RS-485 TxEnable signal)
2. We use http://www.stone-hmi.com, this allows us to change touchscreen size with no change to our board, everything by same connector for UART RS-232.
We didn't find reliable larger screens that worked with ST TouchGFX (or Microchip Harmony).
EDT did have some with STM32 MCUs, but the combinations didn't meet our needs.
It comes down to quantity, are you making <1000/year or >10000/year?
For our specialty project we had to avoid SDCard and most graphics interfaces HDMI/DSI/... as they all required licence fees that just didn't amortize well for our quantities.
3. Yes. And if you can't find them just ask on here. Configure IC first with STM32CubeMX. You can even select existing demo boards to initialize MX.
3a. Our STM32 CAN still in progress, but was much easier than Harmony (Actually CAN in Harmony2 sorta worked, but Harmony3 was a mess a year ago)
4. We bootload our boards from a USB stick on our central module, and share the firmware loads over our proprietary system throughout our network. We also have a logfile on the stick which is great when doing diagnostics in the field (customer can just email the logfile to you and often you can resolve without a visit, standard USB stick fits to any PC). You can also firmware update by USB/UART/more with a PC or other computer, there are examples.
*. All our new boards are STM32,
We were using Microchip Harmony but was just years of poor documentation, and the months wait on harmony support answers was a killer. When they did answer it was usually "Is this still an issue" because it took them months to get to our queries. When I saw the Harmony3 posts echoing the ongoing issues/quality/support from Harmony1 and Harmony2 we decided to change. The ST has been so much nicer, not perfect, but support answers are quick, documentation and examples are cleaner, tools are less buggy. Less errata but still need to check IC errata before ordering PCBs. Things take weeks with ST instead of months with Harmony.
Paul
2021-03-04 02:24 AM
Thank you very much for your answer, from what I understand having a screen directly on the processor, consumes a lot of resources and requires a lot of things (paying)
So from what I see I will start with the following solution: software interface in visual studio, connected by USB to the microprocessor and the processor takes care of managing the equipment.
I looked a little at the complexity of STM and Microchip, the code under STM seems to be very quickly "too" complete I have the impression that everything is in mess ...
2021-03-04 03:58 AM
In don't find any good tutorial to configure CAN and RS485 with CubeMX and then export code and try to understand it
2021-03-04 05:26 AM
RS485 is just UART with DE, send and receive is same as any UART/USART example. In MX ensure enable the DE pin and connect it to both the Receive Enable/Transmit enable pins on your RS485 Driver IC (or only Tx Enable if you want Rx always enabled). You can set the polarity of this signal in the UART settings in MX so shouldn't need an inverter.
CAN: I've misplaced where we started for CAN.
I'd start by looking for your chosen STM32xxxx under MOOC in STM32 Education for examples matched to your MCU.
I'd also do a general search of MOOC/STM32 Education for CAN/J1939/NMEA2000 (variants of CAN).
Useful links for getting started in STM32:
- STM32 Tutorials/Examples:
- Misc Examples we've found helpful:
Not as useful:
Paul
2021-03-04 06:20 AM
Thank you very much for your answers, I learned a lot since the day before yesterday, even too much I would say by dint of informing myself, my head is full!
I asked myself a bit to think about the best way to achieve what I want and came to this conclusion:
1- I am not an expert in microcontrollers and it is so complete that I risk getting lost
2- it is necessary to be able to develop the functionalities without changing the processor each time
So I came to this:
- Interface and program under visua studio (contains all the intelligence)
- The program for sending frames with the modbus protocol (best for exchanging data) to the microcontroller
- The micro is responsible for reading the modbus data, and depending on this: activates outputs (relays) sending frames (CAN) it is also partly responsible for reading the CAN data and sending all this via modbus .
Suddenly, I have to realize:
- Activate CAN1 and CAN2
- Add MODBUS
- Use GPIO
And the function that drive all of this
So, I have been looking for two days non stop for examples of programs to give me an idea but nothing ... I wonder if I will not migrate to microchip ...
2021-03-04 06:52 AM
So you want to have a PC with code written in Visual Studio controlling MODBUS and CAN?
In that case why don't you just do everything on PC, maybe with:
Then you'll only have one piece of code to maintain (code in PC only).
Unless this is a project for a course where you need to develop MCU code?
CAN Protocol Analyzers:
Paul