Other Parts Discussed in Thread: TMS320C6748
Hi,
I'm working with TMS320C6748 I have to use some pin as GPIO that are shared with the HPI port.
I'm trying to set the bits RDY, HCNTL0 and HCNTL1.
The first issue is that GPIO_DIR2 setting does't have effect. Infact I can see its bits to change if I externally move the input signals.
The other issue is that, when the RDY is a gpio input, I see the GPIO_DAT2.10 (0-based) instead of GPIO_DAT2.9 to change :-(
I'm following these docs: SPRUGJ7E - System Configuration Module, and SPRUFM7D - Host Port Interface
Here my code that shoud generate a square wave on the output of RDY, HCNTL0 and HCNTL1:
#define HPIENA 0x00008000
#define CFGCHIP0 *(volatile unsigned int*)(0x01C14000 + 0x17C)
#define CFGCHIP1 *(volatile unsigned int*)(0x01C14000 + 0x180)
#define HPI0_BASE 0x01e10000
#define PID *(volatile unsigned int*)(HPI0_BASE + 0x0000)
#define PWREMU_MGMT *(volatile unsigned int*)(HPI0_BASE + 0x0004)
#define GPIO_EN *(volatile unsigned int*)(HPI0_BASE + 0x000c)
#define GPIO_DIR1 *(volatile unsigned int*)(HPI0_BASE + 0x0010)
#define GPIO_DAT1 *(volatile unsigned int*)(HPI0_BASE + 0x0014)
#define GPIO_DIR2 *(volatile unsigned int*)(HPI0_BASE + 0x0018)
#define GPIO_DAT2 *(volatile unsigned int*)(HPI0_BASE + 0x001c)
#define GPIO_DIR3 *(volatile unsigned int*)(HPI0_BASE + 0x0020)
#define GPIO_DAT3 *(volatile unsigned int*)(HPI0_BASE + 0x0024)
#define HPIC *(volatile unsigned int*)(HPI0_BASE + 0x0030)
#define HPIAW *(volatile unsigned int*)(HPI0_BASE + 0x0034)
#define HPIAR *(volatile unsigned int*)(HPI0_BASE + 0x0038)
#define BIT10 0x00000400
#define BIT9 0x00000200
#define BIT8 0x00000100
#define BIT7 0x00000080
#define BIT6 0x00000040
#define BIT5 0x00000020
#define BIT4 0x00000010
#define BIT3 0x00000008
#define BIT2 0x00000004
#define BIT1 0x00000002
#define BIT0 0x00000001
/* Disable HPI */
CFGCHIP1 &= ~HPIENA;
HPIC |= BIT7;
GPIO_EN = BIT5 + BIT1;
GPIO_DIR2 = BIT9 + BIT7 + BIT6;
while (1) {
GPIO_DAT2 = BIT9 + BIT7 + BIT6;
GPIO_DAT2 = 0;
}