• AVR Freaks

AnsweredHot!PROBLEM: CAN Bus on ATSAMC21 configured by Harmony v3 does not work

Author
Piotr Rutkowski
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2021/02/26 01:19:16
  • Location: 0
  • Status: offline
2021/03/09 01:31:51 (permalink)
0

PROBLEM: CAN Bus on ATSAMC21 configured by Harmony v3 does not work

Hi everybody,
I'm trying to understand the code created by Harmony v3 for ATSAMC21 MCU for CAN peripheral.
If I just try to transmit a message over the bus with CAN0_MessageTransmit() function and no filters are set - it seems to work. It even triggers Tx interrupt, even if only BOE interrupt is enabled.
Whenever I set up any fiter that actually should pass a message that is sent over the bus by another device - Tx interrupt is not handled properly. Rx interrupts are not triggered at all. It seems that function that sets up Message RAM is improper, it sets pointers to RAM section with different order that this one shown in the MCU datasheet. Also when Tx interrupt is triggered - the function somehow detects Rx interrupt - and while Rx FIFO (or Buffer) is empty - whole program crashes with HardFaultHandler().
Can anybody help me with that issue? IS there any working example of Harmony/MPLAB X IDE working CAN peripheral for ATSAM MCUs? I was trying to find it but without success.
 
Thanks in advance,
 
Piotr
#1
Piotr Rutkowski
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2021/02/26 01:19:16
  • Location: 0
  • Status: offline
Re: PROBLEM: CAN Bus on ATSAMC21 configured by Harmony v3 does not work 2021/03/09 05:06:15 (permalink)
0
A little update. I managed to run CAN in polling mode - seems that Message RAM is handled properly...
The next step: interrupts. I will let know if it works (and if anybody is interested).
 
Regards,
 
Piotr
#2
JigneshM
Starting Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2020/05/06 01:13:14
  • Location: 0
  • Status: offline
Re: PROBLEM: CAN Bus on ATSAMC21 configured by Harmony v3 does not work 2021/03/10 05:55:11 (permalink) ☼ Best Answerby Piotr Rutkowski 2021/03/10 05:58:37
5 (1)
Hi,
 
Harmony 3 CAN example applications are available for SAMC21 device as follow.
https://github.com/Microchip-MPLAB-Harmony/csp_apps_sam_c20_c21/tree/master/apps/can/can_fd_operation_blocking

https://github.com/Microchip-MPLAB-Harmony/csp_apps_sam_c20_c21/tree/master/apps/can/can_fd_operation_interrupt_timestamp

https://github.com/Microchip-MPLAB-Harmony/csp_apps_sam_c20_c21/tree/master/apps/can/can_normal_operation_blocking
 
Kindly go through readme.md file of each demo for the hardware setup and how to run the application. All demo examples are working fine.
Thank you.
 
Thanks and Regards
Jignesh Moradiya
 
#3
Piotr Rutkowski
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2021/02/26 01:19:16
  • Location: 0
  • Status: offline
Re: PROBLEM: CAN Bus on ATSAMC21 configured by Harmony v3 does not work 2021/03/10 06:00:14 (permalink)
0
Thank you very much, I was searching for this kind of materials, but without success.
I hope that now my development process will speed up!
 
Regards,
 
Piotr
#4
Jump to:
© 2021 APG vNext Commercial Version 4.5