Skip to main content
Associate III
February 27, 2024
Solved

STM32 API for Delphi

  • February 27, 2024
  • 5 replies
  • 5867 views

Hello All
I tried searching all over. Is there a  STM32  API for Delphi program developers. The idea is that I am Delphi programmer who would like to design custom programs to read/write to STM32F4 development boards. STM32Cube IDE is fine for running the programs on the board. I need to design a custom GUI which will run on my PC so that I could interface with the boards through the USB. I could then read the status of any sensor etc attached to the boards and manipulate the data accordingly. Any know of such an API? 

Best answer by Andrew Neil

Sounds like you're looking for something like Firmata:

https://github.com/firmata/

https://github.com/MrYsLab/FirmataExpress

 

 

5 replies

Andrew Neil
Andrew NeilBest answer
Super User
February 27, 2024

Sounds like you're looking for something like Firmata:

https://github.com/firmata/

https://github.com/MrYsLab/FirmataExpress

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
techdeskAuthor
Associate III
February 27, 2024

Hello and thanks for the reply. You mention Firmata. How do I use this with Delphi? I am really unfamiliar with other languages. However I do know how to program Arduino. Delphi on the other hand will require some Library or component or an API (with all the commands, functions etc)

Andrew Neil
Super User
February 27, 2024

It's a communications protocol - so you'd need to implement that protocol.

Search for Firmata Clients:

https://www.google.com/search?q=delphi+firmata+client


Some more possibilities:

Telemetrix claims to be, "a user-extensible replacement for Standard Firmata without the complexity of Firmata"

https://mryslab.github.io/telemetrix/ 

KuttyPy seems a similar idea?
https://www.hackster.io/jithinbp/kuttypy-microcontrollers-via-real-time-android-pc-interface-afb47f 

https://twitter.com/jithinbp_/status/1762099578428637420

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
February 27, 2024

How do you interface with other Win32 DLL and API ?

Microsoft had all sorts of methods for Mixed Language calling conventions, covering C, FORTRAN, PASCAL, etc

I'd have thought Delphi would facilitate methods of interacting with the rest of the operating system.

Perhaps also ways for interfacing with the driver stack or USB URBs

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
techdeskAuthor
Associate III
February 29, 2024

Ok, I have uploaded the Firmata firmware onto a Uno arduino just for testing.
But now how do I communicate using Delphi. Is there not a "uses" unit or something? I just cannot just go ahead and use the firmata command eg: SET_PIN_MODE, 14, ANALOG.
Can I get some help here please

Andrew Neil
Super User
February 29, 2024

 


@techdesk wrote:

But now how do I communicate using <insert language here>.


Again, that's down to finding (or implementing) a suitable Formata Client - see the earlier search

 


@techdesk wrote:

Is there not a "uses" unit or something? 


Probably best to ask that on a Delphi forum?

 


@techdesk wrote:

Can I get some help here please


Not really for Arduino or Delphi - they are going off-topic for this forum.

You'd be better asking in the Arduino forums: https://forum.arduino.cc/ - there were a few hits in the above-mentioned search ...

The key is to remember that the Arduino or STM32 or whatever is an entirely separate hardware unit, with a comms link to your PC - so what you need is to implement the PC-side of that comms link, in accordance with the Firmata protocol specification.


Addendum

There's a list of various clients here: https://github.com/firmata/arduino#firmata-client-libraries - I don't see Delphi, but maybe one/some of them might help you?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
February 29, 2024

@Andrew Neil wrote:

the Arduino or STM32 or whatever is an entirely separate hardware unit, with a comms link to your PC - so what you need is to implement the PC-side of that comms link, in accordance with the Firmata protocol specification.


Like this:

AndrewNeil_0-1709218749558.png

 

from this tutorial on using Arduino Standard Firmata:

https://roboticsbackend.com/arduino-standard-firmata-tutorial/

it includes a utility to allow you to test it without having to write any PC-side code.

The communication is over a COM port - so, if you're implementing a Client in Delphi, your Delphi will need to interact with the COM port.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
techdeskAuthor
Associate III
February 29, 2024

Thank you for all this info. Ok I did some extensive searching. I now know how to make C wrappers (Fimata) units for Delphi. That is sorted out. Only problem is I cannot find Firmata firmware to upload onto STM32 board. I can only find Firmata for Arduino. Any idea where to download or at least "convert" it to be used with the STM32 board?

Andrew Neil
Super User
February 29, 2024
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Pavel A.
Super User
March 5, 2024

@techdesk If Google cannot find something, it probably does not exist. No problem, get the custom software developed and documented for you.

https://www.fiverr.com/categories/programming-tech/electronics-engineering/embedded-systems-iot

https://www.fiverr.com/categories/programming-tech/software-development/desktop-applications

@Andrew Neil Lazarus is Delphi, resurrected from dead, after the evil Microsoft killed it ((

Andrew Neil
Super User
March 5, 2024

@Pavel A. wrote:

@Andrew Neil Lazarus is Delphi, resurrected from dead, after the evil Microsoft killed it ((


It's not dead - it lives on under the Embarcadero brand:

https://www.embarcadero.com/products/rad-studio 

Including a free community edition:

https://www.embarcadero.com/products/delphi/starter 

Nothing (in this case) to do with the evil Microsoft?

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.