cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between STM32 to NXPK344 via CAN communication using J1939 protocol

sumanuppala
Associate II

Dear STM32 Support Team,

I am working on implementing CAN communication using the standard SAE J1939 protocol on an STM32-based platform and would like your guidance.

Could you please suggest:

  • Recommended STM32 example projects or application notes for J1939 over CAN.

  • Any official STM32Cube examples, middleware, or partner stacks for J1939.

  • Best practices for configuring the CAN peripheral (bitrate, filters, extended ID usage) specifically for J1939 on STM32.

  • Recommended approach for reading GPIO inputs (three switches) and mapping them to different J1939 messages or PGNs.

I am happy to provide details about my MCU part number, board, and current code if needed. Your support would be very helpful for moving this feature to completion.

STM board: STN32F207ZG

Thank you in advance for your assistance.

Best regards,
Suman Uppala

 

9 REPLIES 9
mƎALLEm
ST Employee

Hello,

ST doesn't offer such kind of stacks but one of our partners Emotas offers J1939 stack for STM32. Please refer to this link. So please contact Emotas: https://www.emotas.de/en/contact

You may find  an open source implementation (ST doesn't guarantee the implementation): like this one:

https://github.com/ttnickb/Open-SAE-J1939-STM32

See also this thread.

Hope that helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
sumanuppala
Associate II

Hello ST Team,

I'm looking for guidance on integrating J1939 CAN communication. Could you please share examples showing the proper J1939 protocol frame format for sending data to other devices?

The provided link contains many files, but I'm unsure which ones are relevant for STM32 implementation.

 

Thank you!!

 

With Regards,

SUMAA UPPALA

(Virus scan in progress ...)

Hello @sumanuppala,

I've already answered the question. No example provided for J1939 by ST. We don't support that. Only ST partners are offering such kind of stacks. So please contact our partner Emotas as suggested in my previous post.

I can support you with CAN protocol not for its stacks.

Thank you for your understanding.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Dear STM32 Community,

Could you please help me with sending CAN data from one node to another using STM32F207ZG?

In my application, I want to:

  • Use the on‑board switch of the STM32F207ZG board

  • Connect an external TTP224B touch sensor module as additional switches

  • When switch 1 is pressed, display/send a “LOW” level

  • When switch 2 is pressed, display/send a “MEDIUM” level

  • When switch 3 is pressed, display/send a “HIGH” level

If you have any example projects, code snippets, or configuration guidelines for STM32F207 CAN communication and reading TTP224B inputs, it would be very helpful.

Thank you in advance for your support.

Best regards,
Suman Uppala

There are basic CAN examples available for every MCU variant coming with a CAN peripheral.
I didn't work with F20x variants yet, but picking one family I frequently us at random (the F303), there are four examples: CAN_Loopback, CAN_Networking, CAN_DualFIFO, and CAN_FIFOExtension.
Go with a networking example, it is exactly the setup you have.

> If you have any example projects, code snippets, or configuration guidelines for STM32F207 CAN communication and reading TTP224B inputs, it would be very helpful.

The CAN example delivers the first.

For the sensor, there are hundreds of different sensors available for any kind. You can't expect a MCU pacakge to come with an example for everyone of them. You might need to adapt another peripheral example, and consult the sensor datasheet.

 

J1939 is quite specific protocol stack used in the automotive industry, especially trucking and agricultural machines.
The are no hardware-specifics beside of CAN, so you can take examples or protocol stacks from any platform you find useful.

Any links please I didn't get proper one.


@sumanuppala wrote:

Any links please I didn't get proper one.


https://github.com/STMicroelectronics/STM32CubeF2/tree/master/Projects/STM322xG_EVAL/Examples/CAN

No CAN stack used.

+ Knowledge base articles:

Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 1)

Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 2)

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Andrew Neil
Super User

You might also take a look at this demo, posted by @Gretchev not so long ago:

Simple Classic CAN + FreeRTOS Demo simulating OBD and a vehicle.

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.

@sumanuppala wrote:

guidelines for STM32F207 CAN communication and reading TTP224B inputs


As @Ozone said, you can't expect to find every single possible combination of comms protocols, sensors, etc.

You need to consider these things separately - take a modular approach:

  • The operation of a CAN bus does not depend on what data you're sending over it, or where that data came from (paritucular sensors);
  • The operation of the TTP224B does not depend on what you do with the data after you've read it.
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.