Issues with trace recording

Programmable 6-channel router and data logger for CAN and CAN FD with I/O and optional Ethernet interface
alessandrop
Posts: 10
Joined: Tue 2. Apr 2024, 15:08

Re: Issues with trace recording

Post by alessandrop » Tue 7. Jan 2025, 09:40

Hello Marvin,

Actually, since there were so many problems with the provided firmware, I decided to implement my own custom firmware. Starting from example 21_RTOS_FILESYSTEM and others, I'm now able to:
  • record traces on file of customisable size
  • use a timeout based on CAN traffic and Wake-Up signal detection for saving the file
  • check if the disk is full, then delete the oldest file and a create a new one
The only thing that I was not able to implement so far is the customisation of the baud rate for the different CAN channels without flashing every time a new firmware version.

I basically would like to replicate the feature of the provided firmware, so that I can assign the baud rate for every channel via file.

Since I know that modifying the following variable in can_user.c

Code: Select all

static const CANTiming_t  Timing_CANx[6] = {
_40M_250K_80____2M_80_ISO,	  // CAN1
_40M_250K_80____2M_80_ISO,	  // CAN2
_40M_500K_80____4M_80_ISO,	  // CAN3
_40M_250K_80____2M_80_ISO,	  // CAN4
_40M_250K_80____2M_80_ISO,	  // CAN5
_40M_250K_80____2M_80_ISO	  // CAN6
};
it is possible to change the speed for every channel, I looked for every instances of it and I tried to modify CAN_UserRead, CANQUEUE_TimerCB, CANQUEUE_Startup, and CAN_UserInit functions in order to let them accept a CANTiming_t variable as input from the main function.

Unfortunately, I failed in this. Even if the code compilation goes well, with my implementation no more traces are recorded. Could you please provide me a help? Maybe a sample code of this part already implemented?

Thank you,
Alessandro

M.Heidemann
Sales & Support
Sales & Support
Posts: 1060
Joined: Fri 20. Sep 2019, 13:31

Re: Issues with trace recording

Post by M.Heidemann » Tue 7. Jan 2025, 10:09

Hello Allesandro,

These bitrate-constants are defined in can_user.h ("Inc" folder), if you want to use a different bitrate-config or define your own,
please modify/check this file.

BR

Marvin
---
Marvin Heidemann
PEAK-Support Team

alessandrop
Posts: 10
Joined: Tue 2. Apr 2024, 15:08

Re: Issues with trace recording

Post by alessandrop » Tue 7. Jan 2025, 10:41

As above described, I already found that modifying that file it is possible to use different bitrate. But, I would like to do it programmatically, at runtime.

And given that in the provided firmware this feature is already implemented, I was wondering if you can provide an already working sample code for that part.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1060
Joined: Fri 20. Sep 2019, 13:31

Re: Issues with trace recording

Post by M.Heidemann » Tue 7. Jan 2025, 10:50

Hi,

have a look at the corresponding can_user.c,
this is the init-sequence for the channels.

Use CAN_UnInitialize to bring a channel down again and bring it back up using

Code: Select all

CAN_Initialize ( hBus, &Timing_CANx[hBus]);
Make sure to use your intended bitrate for reinitialization.

This should enable your to change birate during runtime.

BR

Marvin
---
Marvin Heidemann
PEAK-Support Team

alessandrop
Posts: 10
Joined: Tue 2. Apr 2024, 15:08

Re: Issues with trace recording

Post by alessandrop » Thu 9. Jan 2025, 08:31

Thank you for the support, using both CAN_UnInitialize and CAN_Initialize worked.

Locked