Skip to main content
Graduate
July 14, 2024
Question

STM32H750 Performance slows down after time

  • July 14, 2024
  • 5 replies
  • 4576 views

Hi!
I have a problem with the canbus gateway project, I have a very good ring buffer that works without delays and transfers data between can1 and can2. All data copying is done through the main while loop where I check the buffers for can1 and can2 to see if there is anything to send and handle it. The project works great, but after 2-3 hours of driving, strange anomalies start to happen... There is a second delay in data transfer, when I press the reset button on the art-pi board, everything returns to normal and works properly for the next 2-3 hours. I thought it might be a buffer overflow problem which can hold 512 messages for each can. However, when I turn off the vehicle and after a minute there are no frames on the bus and I restart the vehicle, the delay is still there... So it's not the buffers' fault. Has anyone encountered such a problem?

    This topic has been closed for replies.

    5 replies

    Graduate II
    July 14, 2024

    I seriously doubt anyone's got an apples-to-apples case for your issue / failure.

    If you can't understand what your own code is doing, it's not clear how uninvolved parties are going to know.

    Instrument things so you can better understand what's happening internally, and query / probe current state. Perhaps the ability to dump buffer, or memory structures, and reset buffering.

    If using dynamic memory look at fragmentation and resource leaking.

    Technical Moderator
    July 14, 2024

    Dear @sqwerize ,

     

    Also check the Clocks used on your system , a long term jitter may affect CAN bus . If possible to share your setup - crystal , PLL etc.

    Hope it helps.

    STOne-32

    sqwerizeAuthor
    Graduate
    July 14, 2024

    @STOne-32 @Tesla DeLorean 

    Here is screens and my ringbuffer:

     

    sqwerize_7-1720994642276.png

    sqwerize_0-1720994371581.pngsqwerize_1-1720994392309.pngsqwerize_2-1720994409458.pngsqwerize_3-1720994429826.png

    sqwerize_4-1720994584264.pngsqwerize_5-1720994601295.pngsqwerize_6-1720994617735.png

     

    Graduate II
    July 15, 2024

    The count++ count-- method of determining capacity/usage is not thread safe

    Instrument so you can check if head and tail diverge when count reports as zero.

    Technical Moderator
    July 15, 2024

    Hello,

    You need also to check if there were some errors on CAN communication. So activate the error interrupts, check also  TEC and REC counters.

    sqwerizeAuthor
    Graduate
    July 15, 2024

    Hey, I found a similar problem on another forum, so maybe it's not entirely a canbus problem... 

    https://forum.arduino.cc/t/stm32-performance-slowing-down-over-time/1005525

    Technical Moderator
    July 15, 2024

    To my knowledge, we didn't have a such kind of issues from our customers.

    The link you provided, the guy is using STM32F103 which is completely different from yours (STM32H750): different architecture, different CAN cell: STM32F103 has bxCAN cell (classical CAN)  while H7 has FDCAN cell were you are using it in CAN-FD mode. This means, most probably it's not related to the CAN HAL driver nor to the CAN cell. But from your usage of it: software of HW.

    You need to instrument your code and check the CAN errors. There is no solution off the shelf in this kind of situation.

    Graduate II
    July 15, 2024

    Add a buffer reset function that clears head, tail, count, to see if that recovers the latency/lag situation.