matth-x / MicroOcpp

OCPP 1.6 / 2.0.1 client for microcontrollers
MIT License
351 stars 149 forks source link

Guidance needed on Porting ArduinoOCPP library on STM32 controller #172

Closed mukeshtalks closed 1 year ago

mukeshtalks commented 1 year ago

Hello All and @matth-x ,

I want to port this library on STM32 Controller. I want to use STM32 CUBE IDE to compile the code need suggestion and guidance about how this can be ported, What are the dependencies of Arduino I need to resolve? If anyone already experienced this or tried please help. Is there any need to RTOS or bare matel can be ported?

matth-x commented 1 year ago

Hi @mukeshtalks,

At the moment, no public demonstration of this exists yet. It would be a great contribution if you open source a minimal example integration. In case you discover compilation issues, feel free to open a PR to this repo.

MicroOcpp is designed for minimal dependencies on the host system. It does require:

There are no explicit dependencies on the Arduino API or an RTOS. You can find further information on this topic here: https://matth-x.github.io/MicroOcpp/intro-tech/

Please continue this issue if I forgot something in this list.

Edit (2023-09-29): update naming scheme

mukeshtalks commented 1 year ago

@matth-x thank you for your prompt reply. Sure I will try and keep posting in case any issue I face. If I f I understood correctly the same library you have used as a backend in Arduino OCPP Simulator and integrated with the web interface on the Linux environment. And you have used the Arduino Libraries. If I take the same Arduino Simulator source code without a web interface and make the changes as you suggested and compile it on STM32 CUBE IDE will this help me to start with? If yes then it will be starting point for me.

matth-x commented 1 year ago

@mukeshtalks Yes, the Simulator is a good starting point. And your understanding is correct, except that the Linux integration doesn't need any Arduino code - it only needs Mongoose, ArduinoJson (doesn't need Arduino as well) and the standard C++ libraries. If you run into any compiler errors, you can follow the corresponding steps above to resolve them.

mukeshtalks commented 1 year ago

@matth-x thank you for your reply. I will try and keep posting.

pamukcu09 commented 1 year ago

@matth-xCevabın için teşekkürler. Paylaşım yapmaya devam edeceğim.

Hi @mukeshtalks, Have you made any progress in integrating the library into STM32?

What should we define MOCPP_PLATFORM as?

GanesanGuru commented 12 months ago

Hi @mukeshtalks,

At the moment, no public demonstration of this exists yet. It would be a great contribution if you open source a minimal example integration. In case you discover compilation issues, feel free to open a PR to this repo.

MicroOcpp is designed for minimal dependencies on the host system. It does require:

* [https://github.com/bblanchon/ArduinoJson](ArduinoJson) on the include path so `#include <ArduinoJson.h>` works

* Clock which provides the time since boot in ms. This needs to be a callback function which will be passed to its setup function in [Platform.h](https://github.com/matth-x/ArduinoOcpp/blob/master/src/MicroOcpp/Platform.h): `void mo_set_timer(unsigned long (*get_ms)());`. On custom platforms, the build flag `MOCPP_CUSTOM_TIMER` must be set

* WebSocket adapter which suits the `Connection` interface in [Connection.h](https://github.com/matth-x/MicroOcpp/blob/master/src/MicroOcpp/Core/Connection.h). This adapter needs to be passed to the OCPP library during initialization in the `mocpp_initialize(...)` function. Also, the build flag `MOCPP_CUSTOM_WS` needs to be set. A [WebSocket adapter for Mongoose](https://github.com/matth-x/MicroOcppMongoose) is already publicly available which should also suit the STM platform. As an example, the [MicroOcppSimulator](https://github.com/matth-x/MicroOcppSimulator/) is probably a good reference.

* Filesystem adapter which suits the `FilesystemAdapter` interface. The filesystem has only little importance for a first integration, so you can skip this. This also needs to be passed to `mocpp_initialize(...)`. The build flag `MOCPP_DEACTIVATE_FLASH` needs to be set.

* Debug information is sent to an output stream using a callback `console_out` which is set via `void mo_set_console_out(void (*console_out)(const char *msg));`. The build flag `MOCPP_CUSTOM_CONSOLE` needs to be set.

There are no explicit dependencies on the Arduino API or an RTOS. You can find further information on this topic here: https://matth-x.github.io/MicroOcpp/intro-tech/

Please continue this issue if I forgot something in this list.

Edit (2023-09-29): update naming scheme

Hi @matth-x , Regarding the FileSystem Adapter for iMX RT1064, Can we skip or deactivate the FS completely for initial integration. If so how to do so - as MOcppMongooseClient constructor requires FilesystemAdapter as parameter..

Also, what is the significance of MicroOcppMongooseClient_c.cpp vs MicroOcppMongooseClient.cpp files?