Consider not using a RPi and especially not Python for the reasons you note. Consider writing your application in "C" and using a development board like this for the actual interface;49thdiver wrote: ↑Thu Dec 22, 2022 3:19 pm Hi, I have just started to scratch the surface on this and immediately found a few interesting remarks, regarding Raspberry Pi and Python.
Regarding PPi.GPIO
- If you need more accurate timing use bare metal RPi (which makes it work like a microcontroller), use a real-time OS with a better pre-emptive dispatcher or run the timing function on an Arduino (which is a single task microcontroller).
Regarding the Python function Time
- Note that this module is unsuitable for real-time or timing critical applications. This is because you can not predict when Python will be busy garbage collecting. It also runs under the Linux kernel which is not suitable for real time applications - it is multitasking O/S and another process may be given priority over the CPU, causing jitter in your program. If you are after true real-time performance and predictability, buy yourself an Arduino
In my experience capturing and processing CAN on a Nissan Leaf is a challenging feat, the sheer volume of data is huge. The leaf is sending and receiving data at millisecond (ms)speeds perhaps microsecond (us) speeds. Just to fake out the OBC you need to send on average 5 messages every 10ms. To do rea-ltime CAN filtering I ended up using Mux's bare metal processor design with "C" to be able to catch and process the messages from the Leaf.
So my Question out to the group before I dig too much deeper does anybody else have any experience and success with using a RPi and Python in this kind of a real-time application where the timing is critical ie sending multiple messages every 10ms with sustained accuracy
General comments welcome my only experience with Python is with processing data for user interface for a web based OBDII device.
Thanks, all the best to everyone over the winter season -10 on Vancouver Island this morning, very unusual. the Ev got us where we needed to go, YEAH.
Peter
https://www.digikey.com/en/products/det ... K/10294225
https://www.silabs.com/documents/public ... asheet.pdf
It has the functions you'll need, e.g. real time interrupts, timers, & a UART
And with the CAN function (EFM8 and MCP2515) here;
https://community.silabs.com/s/question ... uage=en_US
If you want to overkill the application, here's a 32 bit solution; https://www.silabs.com/mcu/32-bit-micro ... ?tab=specs
Silicon Labs provides a C compiler running on Windows, which loads the development board's flash memory once complied.
It also provides an assembler output, if you like to tweak the assembler code.