MSCAN Filters, why two? - HC08GZ

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MSCAN Filters, why two? - HC08GZ

3,675 Views
Bloodhound
Contributor I
Hi All,
 
Just playing around with the MSCAN module in the HC08GZ, I finally got the thing talking on the CAN bus, but I am a little confused on the overall point of having two message filters, CIDMR0 - CIDMR3  and CIDAR0 - CIDAR3. Maybe I am reading it wrong, but they seem to serve the same purpose?
 
The way I understand it is the registers CIDMR0 - CIDMR3 are like a primary message filter because they should only be configured when initializing the MSCAN.
So that leaves the I.D acceptance registers which can provide further message filtering to those passed through from CIDMR0 - CIDMR3.
 
So as an example, I could set CIDMR0 - CIDMR3 to only accept messages within the ID range of $100 - $400
Then the ID acceptance registers can be defined to filter a specific message from the range within $100 - $400 as that was all that was passed through from CIDMR0 - CIDMR3.
If this is how it works then it seems a little bit limiting to have just two ID acceptance filters.
What happens if I wanted to get messages from ID's $101, $183, $202, $234, $340, $389 ?, do I just allow the ID acceptance filters to pass all through from $100 - $400 then do an individual comapre once the message has arrived? which is not ideal because it would mean a 16bit compare for each ID.
 
Thanks in advance,
Ross



Message Edited by Bloodhound on 2007-12-06 08:43 PM

 

Added p/n to subject



Message Edited by NLFSJ on 2007-12-06 09:10 AM
Labels (1)
0 Kudos
6 Replies

707 Views
Bruce_andrew
Contributor I
As explained by others, you have a match filter, and a mask filter. The match filter is used to specify the bits that need to match. The mask filter specifies the bits that "don't care".

Filters is great if you need high speed, and have just a few specific IDs that you need to receive. It's fast because you don't need any code to process the messages. In fact the core (CPU) doesn't even see the messages unless it gets a "hit" with the filter.

For slow speed CAN, you can do without using filters. I use the GZ (new designs use the DZ now). I have a slow speed CANbus (<100Kb/s) and a lot of IDs. So I don't use the filter (set the mask so that all bits are "don't care"). I use multiple switch/case statements on blocks of IDs. Not the quickest or smallest bit of code, but it's easy to manage.

HTH :smileyhappy:
0 Kudos

707 Views
Bloodhound
Contributor I
Thanks Alban, I'll be honest, I'm still not not 100% on the 'concept' behind the two filters.
Perhaps can you please give an example (not code, just descriptive) on the interaction between the two?
 
Thanks,
Ross
0 Kudos

707 Views
Bloodhound
Contributor I
I stumbled on this doc -
I'll have good read of that, it looks like it explains it very well.
 
Cheers,
Ross
0 Kudos

707 Views
Nabla69
Contributor V
Hello Ross,
 
Indeed, this is the document I had in mind.
Otherwise the datasheet should have a chapter with a graph showing the association of the different registers.
 
IMPORTANT: the msCAN configuration software is not available anymore and that is why the AN2010 was removed from the global FSL website.
 
Cheers,
Alban.
0 Kudos

707 Views
Bloodhound
Contributor I
Alban, you wouldn't happen to know the .exe or install package name for that msCAN Filter Generator program would you?, just to help a guy on Google, Emule etc?
 
Cheers,
Ross
0 Kudos

707 Views
Nabla69
Contributor V
Hello Ross,

CIDAR and CIDM do NOT serve the same purpose!

The CIDAR will indicate the value of the BIT you wish,
The CIDM will indicate if the BIT has to be considered or not. (=mask)

Then with the combination of both, you can filter bit by bit to say:
- I don't care about this bit,
- I want this bit to be a 1,
- I want this bit to be a 0.

Do see what I'm trying to explain shortly ?

Then you can combine these filters to put them either in parallel or in series. (The msCAN12 works the same way, except with more filters).

Alban.
0 Kudos