52235: ANALOG INPUTS

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

52235: ANALOG INPUTS

2,480 Views
p_vagnoni
Contributor III
Hello,
 
I need to use the analog inputs on 52235. Have you some example to understand reading reference manual and C-source example?
 
Thanks all,
 
Paolo
Labels (1)
0 Kudos
Reply
4 Replies

675 Views
DrSeuss
Contributor I
Thank you.
You are correct.
Should be:

#define MCF_GPIO_PANPAR_AN0_AN0 (0x01)
#define MCF_GPIO_PANPAR_AN1_AN1 (0x02)

I will have this corrected.
0 Kudos
Reply

676 Views
p_vagnoni
Contributor III
Hello,
 
I found another error on gpio.h file:
 
/* Bit definitions and macros for MCF_GPIO_PNQPAR */
...
#define MCF_GPIO_PNQPAR_IRQ1_IRQ1      (0x0004)
#define MCF_GPIO_PNQPAR_IRQ2_IRQ2      (0x0010)
#define MCF_GPIO_PNQPAR_IRQ3_IRQ3      (0x0040)
#define MCF_GPIO_PNQPAR_IRQ4_IRQ4      (0x0100)
#define MCF_GPIO_PNQPAR_IRQ5_IRQ5      (0x0400)
#define MCF_GPIO_PNQPAR_IRQ6_IRQ6      (0x1000)
#define MCF_GPIO_PNQPAR_IRQ7_IRQ7      (0x4000)
#define MCF_GPIO_PNQPAR_IRQ1_SYNCA     (0x8000)
#define MCF_GPIO_PNQPAR_IRQ1_PWM1      (0xC000)

/* Bit definitions and macros for MCF_GPIO_PANPAR */
...
 
 
I think MCF_GPIO_PNQPAR_IRQ1_SYNCA wuld be (0x0008) /* secondary function for pin 55 */
 
I think MCF_GPIO_PNQPAR_IRQ1_PWM1 wuld be (0x000C) /* tertiary function for pin 55 */
 
Best Regards
0 Kudos
Reply

676 Views
p_vagnoni
Contributor III
Hello,
 
New errors on definition for PORT AS in GPIO.H file of CodeWarrior:
 
OLD DEFINITIONS:
/* Bit definitions and macros for MCF_GPIO_PASPAR */
#define MCF_GPIO_PASPAR_PASPAR0(x)     (((x)&0x03)<<0)
#define MCF_GPIO_PASPAR_PASPAR1(x)     (((x)&0x03)<<2)
#define MCF_GPIO_PASPAR_PASPAR2(x)     (((x)&0x03)<<4)
#define MCF_GPIO_PASPAR_PASPAR3(x)     (((x)&0x03)<<6)
#define MCF_GPIO_PASPAR_SCL_GPIO       (0x00)
#define MCF_GPIO_PASPAR_SDA_GPIO       (0x00)
#define MCF_GPIO_PASPAR_SYNCA_GPIO     (0x00)
#define MCF_GPIO_PASPAR_SYNCB_GPIO     (0x00)
#define MCF_GPIO_PASPAR_SCL_SCL        (0x01)
#define MCF_GPIO_PASPAR_SDA_SDA        (0x04)
#define MCF_GPIO_PASPAR_SYNCA_SYNCA    (0x10)
#define MCF_GPIO_PASPAR_SYNCB_SYNCB    (0x40)
#define MCF_GPIO_PASPAR_SCL_CANTX      (0x02)
#define MCF_GPIO_PASPAR_SDA_CANRX      (0x08)
#define MCF_GPIO_PASPAR_SYNCA_CANRX    (0x20)
#define MCF_GPIO_PASPAR_SYNCB_CANTX    (0x80)
#define MCF_GPIO_PASPAR_SCL_TXD2       (0x30)
#define MCF_GPIO_PASPAR_SDA_RXD2       (0xC0)
 
NEW DEFINITIONS:
/* Bit definitions and macros for MCF_GPIO_PASPAR */
#define MCF_GPIO_PASPAR_PASPAR0(x)     (((x)&0x03)<<0)
#define MCF_GPIO_PASPAR_PASPAR1(x)     (((x)&0x03)<<2)
#define MCF_GPIO_PASPAR_PASPAR2(x)     (((x)&0x03)<<4)
#define MCF_GPIO_PASPAR_PASPAR3(x)     (((x)&0x03)<<6)
/* PORT 0 */
#define MCF_GPIO_PASPAR_SCL_GPIO       (0x00)
#define MCF_GPIO_PASPAR_SCL_SCL        (0x01)
#define MCF_GPIO_PASPAR_SCL_CANTX      (0x02)
#define MCF_GPIO_PASPAR_SCL_TXD2       (0x03)
/* PORT 1 */
#define MCF_GPIO_PASPAR_SDA_GPIO       (0x00)
#define MCF_GPIO_PASPAR_SDA_SDA        (0x04)
#define MCF_GPIO_PASPAR_SDA_CANRX      (0x08)
#define MCF_GPIO_PASPAR_SDA_RXD2       (0x0C)
/* PORT 2 */
#define MCF_GPIO_PASPAR_SYNCB_GPIO     (0x00)
#define MCF_GPIO_PASPAR_SYNCB_SYNCB    (0x10)
#define MCF_GPIO_PASPAR_SYNCB_CANRX    (0x20)
#define MCF_GPIO_PASPAR_SYNCB_FEC_MDC  (0x30)
/* PORT 3 */
#define MCF_GPIO_PASPAR_SYNCA_GPIO     (0x00)
#define MCF_GPIO_PASPAR_SYNCA_SYNCA    (0x40)
#define MCF_GPIO_PASPAR_SYNCA_CANTX    (0x80)
#define MCF_GPIO_PASPAR_SYNCA_FEC_MDIO (0xC0)
I move the definition to have a better reading definition for a single pin functions. There was a swap between the pins SYNCA and SYNCB.
I use the table 2.1 of the reference manual to have a correct reference (Is this correct?)
 
Best regards
 
0 Kudos
Reply

676 Views
p_vagnoni
Contributor III
Hi all,
 
I Just found an error in the CodeWarrior header file gpio.h generated. Infact in the bit definition of port AN I found:
 
/* Bit definitions and macros for MCF_GPIO_PANPAR */
...
...
#define MCF_GPIO_PANPAR_AN0_AN0        (0x02)
#define MCF_GPIO_PANPAR_AN1_AN1        (0x03)
#define MCF_GPIO_PANPAR_AN2_AN2        (0x04)
#define MCF_GPIO_PANPAR_AN3_AN3        (0x08)
#define MCF_GPIO_PANPAR_AN4_AN4        (0x10)
#define MCF_GPIO_PANPAR_AN5_AN5        (0x20)
#define MCF_GPIO_PANPAR_AN6_AN6        (0x40)
#define MCF_GPIO_PANPAR_AN7_AN7        (0x80) 
 
the bit definition of bit AN0 and AN! are wrong!
 
Bye,
0 Kudos
Reply