avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] Confusing names for some CAN registers bits in iocanxx.h


From: Bernard Fouché
Subject: [avr-libc-dev] Confusing names for some CAN registers bits in iocanxx.h
Date: Thu, 13 Mar 2008 13:47:09 +0100
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

Hello List.

I'm using iocanxx.h version 1.1.2.4 and I've just checked that avr-libc-1.6.1 having version 1.7 of iocanxx.h shows the same problem.

The problem is the following:

- CAN bus supports 11 or 29 bits identifier. I'm currently writing code for a product using an AT90CAN128 and that has to work with these two kinds of identifiers.

- IMHO Atmel made a poor choice by using the same bit names for bit located at different places in some registers, depending of the use of 11 or 29 bits identifiers.

For instance:

-  in 11 bit identifier mode, register CANIDT2 has bit IDT0 as bit number 5.

- in 29 bit identifier mode, register CANIDT4 has bit IDT0 as bit number 3.

(I use IDT0 as an example, but the situation is the same for all bits 0 to 10)

iocanxx.h uses the correct bit names for 29 bit identifiers, for instance there is in iocanxx.h:

#define IDT0  3

If one wants to use 11 bits identifiers and use bit names like 'IDT0', the result is wrong.

Since IMHO the problem comes from the way the bit names were choosen by Atmel, I dunno what solution to offer, maybe renaming the bit names like:

#define ID11B_IDT0   5
#define ID29B_IDT0   3

The problem is the same for bit names in the set of registers IDMSK[1-4].

Regards,

   Bernard





reply via email to

[Prev in Thread] Current Thread [Next in Thread]