Skip to main content
Associate III
January 14, 2025
Solved

How to pass CAN bus data to the BLE stack using the sequencer?

  • January 14, 2025
  • 2 replies
  • 2755 views

Hello, I have a STM32WB55RE connected to a CAN bus.  I'm receiving the CAN data via the Main function using polling.  When a message is received (250K Baud Rate) I want to forward that data to the BLE stack so I can send it to another STM32WB55RE.  I'm currently using the sequencer to manage all the BLE tasks.  There doesn't seem to be any queue or semaphore that I can use with the sequencer.

Is there a preferred method to CAN bus data from the Main loop to a task running within the sequencer?

Kindest regards.

Best answer by mƎALLEm

Handshaking mechanism is important for such data handling involving the synchronization between producer/consumer. That's why multiple/circular buffering is suitable for such case even by using Tasks because there is a difference in the throughput between the interfaces.

See an example of Circular buffer implementation.

2 replies

mƎALLEm
Technical Moderator
January 15, 2025

Hello,

But STM32WB55 device has no CAN interface. How are you receiving CAN frames with it?

SofLit_0-1736936602511.png

 

"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."
kumaichiAuthor
Associate III
January 15, 2025

Hello,

Thank you for your response.  The CAN bus data is being collected via a MCP2515-I/ML and MCP2562T-E_MF.  I'm receiving the CAN bus data correctly.  Just can't figure out the best way to transfer that data to the BLE stack to be sent.  I'm using the default sequencer from the P2P_Server/Client applications.

Kindest regards

mƎALLEm
Technical Moderator
January 15, 2025

Hello,

Now it's clear.

MCP2515: CAN controller over SPI.

MCP2562: is the CAN transceiver.

So your question is about MCP2515 SPI throughput versus the Bluetooth. The interface having the less throughput will be the bottleneck + How CPU will be able to handle that transfer based on that throughput (maybe using DMA?). I'm not expert of wireless but I think what you need to care of, is to manage the double/multiple buffering data transfer between SPI and Bluetooth.

"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
January 15, 2025

Why would it make any difference that the data came from CAN?

As far as the BLE stack is concerned, surely, it's just data - the interface over which it arrived is irrelevant?

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.