Replicating MCAN ASF example to new START project

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, I'm new to Atmel/Microchip and I hope I'm posting this in the correct forum...

I'm working on a project that utilizes CAN, something else I haven't worked with before.  I'm using a SAM V71 Xplained Ultra dev kit to get started.  It has an ATSAMV71Q21B, but our actual project will have an ATSAMV70N20.  I'm able to work on the dev kit at home and need to be in the office to use the test board with the V70N20, so I'd like to create a project that can be built for either to give me more development freedom.

I was able to get an MCAN ASF example project working on my dev kit using a Komodo CAN Duo.  My plan is to replicate that functionality in a new START project.  Then, I would like to copy that project to another that will use V70N20 drivers for the test board.  And then I would go on to make a single project with two build configurations.


So where I'm stuck now, there's a function in the ASF example that sets SFID2 for CAN filtering:

static void mcan_set_standard_filter_0(void)
	struct mcan_standard_message_filter_element sd_filter;

	sd_filter.S0.bit.SFID1 = MCAN_RX_STANDARD_FILTER_ID_0;
	sd_filter.S0.bit.SFEC =

	mcan_set_rx_standard_filter(&mcan_instance, &sd_filter,
	mcan_enable_interrupt(&mcan_instance, MCAN_RX_BUFFER_NEW_MESSAGE);

However, the START equivalent does not contain that capapbility:

 * \brief Set CAN to the specified mode
int32_t _can_async_set_filter(struct _can_async_device *const dev, uint8_t index, enum can_format fmt,
                              struct can_filter *filter)
	struct _can_standard_message_filter_element *sf;
	struct _can_extended_message_filter_element *ef;

	sf = &((struct _can_context *)dev->context)->rx_std_filter
; ef = &((struct _can_context *)dev->context)->rx_ext_filter
; if (fmt == CAN_FMT_STDID) { if (filter == NULL) { sf->S0.val = 0; return ERR_NONE; } sf->S0.val = filter->mask; sf->S0.bit.SFID1 = filter->id; sf->S0.bit.SFT = _CAN_SFT_CLASSIC; sf->S0.bit.SFEC = _CAN_SFEC_STF0M; } else if (fmt == CAN_FMT_EXTID) { if (filter == NULL) { ef->F0.val = 0; return ERR_NONE; } ef->F0.val = filter->id; ef->F0.bit.EFEC = _CAN_EFEC_STF0M; ef->F1.val = filter->mask; ef->F1.bit.EFT = _CAN_EFT_CLASSIC; } return ERR_NONE; }

I tried changing the "Reject Remote Frames" settings on the START menu:

But that didn't alter the function.

Is it expected practice to edit the generated START HPL functions, and others?  Or should there be a way to make the change using the START menu?

Or should I use a completely different approach, like only use the ASF example and abandon START?

Thanks for any feedback!

Last Edited: Mon. Feb 7, 2022 - 07:53 PM