Hello PEAK-Support Team,
do you have a fimrware example which includes a configurable routing and the logging feautre?
We would like to use the router with a customized routing function plus log the received and sent CAN messages using a SD card. We also planned to use the integrated backup battery to be buffer the operation (but thats not our main topic). Are there any examples available? I found your compiled logging firmware and the c-code examples but nothing related to logging on SD card (by the way a short description in a separate text file covering all your examples for one device would be nice).
Thank you!
Routing + Logging (+ Backup Battery) example?
-
- Posts: 14
- Joined: Mon 27. Jan 2020, 09:58
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: Routing + Logging (+ Backup Battery) example?
Hello,
Thank you for your request.
Currently we do not offer a example combining the logger firmware and the regular routing firmware. But you can start with taking a look at the example "21_RTOS_FILESYSTEM" which shows how to acccess to the file system and how data can be written to it. This can be taken as a basis for your own implementation combining file access and the routing shown in other examples.
An example on how to use the backup battery is provided with the example "16_ACCU_BACKUP".
If these examples are missing please make sure to download the most recent PeakDev-Pack:
https://www.peak-system.com/quick/DLP-DevPack
I'll relay you suggestion reagrding a text-file description to our development-team.
Best Regards
Marvin
Thank you for your request.
Currently we do not offer a example combining the logger firmware and the regular routing firmware. But you can start with taking a look at the example "21_RTOS_FILESYSTEM" which shows how to acccess to the file system and how data can be written to it. This can be taken as a basis for your own implementation combining file access and the routing shown in other examples.
An example on how to use the backup battery is provided with the example "16_ACCU_BACKUP".
If these examples are missing please make sure to download the most recent PeakDev-Pack:
https://www.peak-system.com/quick/DLP-DevPack
I'll relay you suggestion reagrding a text-file description to our development-team.
Best Regards
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
-
- Posts: 14
- Joined: Mon 27. Jan 2020, 09:58
Re: Routing + Logging (+ Backup Battery) example?
Hello Marvin,
after a while I start reviewing the code examples 20_RTOS, 21_RTOS_FILESYSTEM and 07_PEAK_FLASH.
What I integrated so far is the 07_PEAK_FLASH function to flash update the router using Peak Flash (no need to use the encoder switch): I added the lib libPFLASH_RPROFD_02.a to the Makefile added a call of PFLASH_Milli();
and finally added a call to the lib for processing in my main_thread CAN-queue (if (RxMsg.id == 0x7E7 && ...), my PFLASH_UserWrite uses also the thread safe CAN write function "CAN___Write". It is working and I hope that you can also confirm that this should work (timing / thread safety)?
Questions regarding routing mechanisms:/functions
Dominik
after a while I start reviewing the code examples 20_RTOS, 21_RTOS_FILESYSTEM and 07_PEAK_FLASH.
What I integrated so far is the 07_PEAK_FLASH function to flash update the router using Peak Flash (no need to use the encoder switch): I added the lib libPFLASH_RPROFD_02.a to the Makefile added a call of PFLASH_Milli();
Code: Select all
static void CANQUEUE_TimerCB ( void *argument)
{
static CANRxMsgDMA_t RxDMAMsg __attribute__((section(".bss.dtcm")));
static uint8_t hal_tick_scale;
// process hal ticks also here
hal_tick_scale++;
if ( hal_tick_scale >= OS_TICKS_PER_MS)
{
// one millisecond left
// inc HAL ticks
HAL_IncTick();
hal_tick_scale = 0;
// Processes PEAK Flash specific stuff. Must be called once per milli
PFLASH_Milli();
}
...
Questions regarding routing mechanisms:/functions
- In your example 20_RTOS you're using two different threads to read and write (thread_rcv and thread_xmt). In thread_xmt the osDelay function was used to sent a CAN message periodically --> I need to transmit some messages (generated out of different CAN messages received by the router) with different frequencys (for exmaple 20ms, 50ms and 100ms).
- I was wondering if this would be better done in my case with three different timer threads (osTimerNew --> osTimerPeriodic) instead of a single transmit thread with osDelay's?
- Are you setting somewhere the priority of both threads?
- I planned to reuse the main_thread() function from 21_RTOS_FILESYSTEM since it contains the (SD-Card) logging mechanism, which I want to use during normal router operation to log transmitted/received CAN messages. Or is routing & logging too much for the microcontroller (or the SD-Card) be processed in parallel?
- Any other suggestions/recommendations from your end (I don't want to run into any issues with delayed or lost messages due to thread related problems)? Now while writing the text I'm wondering if I need some mutexes to control read write cycles of my CAN objects...
Dominik
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: Routing + Logging (+ Backup Battery) example?
Hello Dominik,
Thank you for your feedback.
We do not support RTOS development, this would go beyond the
scope of support we can provide.
The RTOS examples are just a basis for your own development,
there are many ressources online regarding RTOS development which
can be consulted.
The Microcontroller should be able to handle routing and I/O file operations in paralell, however ,
You will have to keep in mind that I/O operations from/to SD-card will take
a certain amount of time, to prevent fpga overruns a software-queue
was implement in the 21_RTOS_FILESYSTEM example, a timer callback will check for new messages
on the FPGA, see the comments in code regarding this:
The used RTOS project can be found on github:
https://github.com/ARM-software/CMSIS_5
For RTOS specific development we'd recommend to get in touch with the RTOS community.
Best Regards
Marvin
Thank you for your feedback.
We do not support RTOS development, this would go beyond the
scope of support we can provide.
The RTOS examples are just a basis for your own development,
there are many ressources online regarding RTOS development which
can be consulted.
The Microcontroller should be able to handle routing and I/O file operations in paralell, however ,
You will have to keep in mind that I/O operations from/to SD-card will take
a certain amount of time, to prevent fpga overruns a software-queue
was implement in the 21_RTOS_FILESYSTEM example, a timer callback will check for new messages
on the FPGA, see the comments in code regarding this:
Code: Select all
// Here we will use one of the mass storage devices (MSD) like eMMC.
// Due to limited FPGA memory for CAN messages we added a software based
// CAN queue. The main_thread() will not read from FPGA directly. Instead
// we use a timer callback to check FPGA for new CAN messages cause memory
// card might need some millis for file-IO operations.
https://github.com/ARM-software/CMSIS_5
For RTOS specific development we'd recommend to get in touch with the RTOS community.
Best Regards
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
-
- Posts: 10
- Joined: Tue 2. Apr 2024, 15:08
Re: Routing + Logging (+ Backup Battery) example?
Hello Dominik, I know that the original post is pretty old, but in the end, did you manage to obtain a working firmware with the features you mentioned at the top of the opening post?Dominik M. wrote: ↑Tue 16. Feb 2021, 18:24Hello PEAK-Support Team,
do you have a fimrware example which includes a configurable routing and the logging feautre?
We would like to use the router with a customized routing function plus log the received and sent CAN messages using a SD card. We also planned to use the integrated backup battery to be buffer the operation (but thats not our main topic). Are there any examples available? I found your compiled logging firmware and the c-code examples but nothing related to logging on SD card (by the way a short description in a separate text file covering all your examples for one device would be nice).
Thank you!
If so, could you please share the source file so that other people can use it?
Thank you very much.
Alessandro