Other Parts Discussed in Thread: SYSCONFIG
Tool/software: Starterware
Hello,
I have got the IDK-AM437x development kit and try to use the SPI on the J16 connector with some GPIO's.
As base I use the PDK Project "MCSPI_BasicExample_idkAM437xarmTestProject".
I want to enable some GPIO's on the J16 connector and use them for extendet SPI functions. SO i added the following to the following files:
To check if anything is working I added the pinmux for the two rgb leds on the board.
File: "SPI_idkAM437x_board.c"
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_v1.h>
#include <stdio.h>
/* Port and pin number mask for GPIO Load pin.
Bits 7-0: Pin number and Bits 15-8: (Port number + 1) */
#define AM437X_IDK_GPIO_LD_PIN (0x0401)
/* LED 0 */
#define GPIO_LED0_RED_PIN_NUM (0x18) //P2.24 A22
#define GPIO_LED0_RED_PORT_NUM (0x02) //P2.24 A22
#define GPIO_LED0_GREEN_PIN_NUM (0x19) //P2.25 A24
#define GPIO_LED0_GREEN_PORT_NUM (0x02) //P2.25 A24
#define GPIO_LED0_YELLOW_PIN_NUM (0x16) //P2.22 B23
#define GPIO_LED0_YELLOW_PORT_NUM (0x02) //P2.22 B23
/* LED 1 */
#define GPIO_LED1_RED_PIN_NUM (0x17) //P2.23 A23
#define GPIO_LED1_RED_PORT_NUM (0x02) //P2.23 A23
#define GPIO_LED1_GREEN_PIN_NUM (0x0D) //P4.13 AB25
#define GPIO_LED1_GREEN_PORT_NUM (0x04) //P4.13 AB25
#define GPIO_LED1_YELLOW_PIN_NUM (0x10) //P4.16 AD21
#define GPIO_LED1_YELLOW_PORT_NUM (0x04) //P4.16 AD21
#define GPIO_USER_1_PIN_NUM (0x11) //P4.17 AE21
#define GPIO_USER_1_PORT_NUM (0x04) //P4.17 AE21
#define GPIO_USER_2_PIN_NUM (0x13) //P4.19 AE23
#define GPIO_USER_2_PORT_NUM (0x04) //P4.19 AE23
#define GPIO_USER_3_PIN_NUM (0x15) //P4.21 AE24
#define GPIO_USER_3_PORT_NUM (0x04) //P4.21 AE24
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] = {
/* Output pin : AM437X_IDK_LD_PIN */
AM437X_IDK_GPIO_LD_PIN | GPIO_CFG_OUTPUT ,
/* Output pin LED0 RED P2.24*/
GPIO_DEVICE_CONFIG( (GPIO_LED0_RED_PORT_NUM + 1), GPIO_LED0_RED_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin LED0 Green P2.25*/
GPIO_DEVICE_CONFIG( (GPIO_LED0_GREEN_PORT_NUM + 1), GPIO_LED0_GREEN_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin LED0 Yellow P2.22*/
GPIO_DEVICE_CONFIG( (GPIO_LED0_YELLOW_PORT_NUM + 1), GPIO_LED0_YELLOW_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin LED1 RED P2.23*/
GPIO_DEVICE_CONFIG( (GPIO_LED1_RED_PORT_NUM + 1), GPIO_LED1_RED_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin LED1 Green P4.13*/
GPIO_DEVICE_CONFIG( (GPIO_LED1_GREEN_PORT_NUM + 1), GPIO_LED1_GREEN_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin LED1 Yellow P4.16*/
GPIO_DEVICE_CONFIG( (GPIO_LED1_YELLOW_PORT_NUM + 1), GPIO_LED1_YELLOW_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin USER 1 P4.17*/
GPIO_DEVICE_CONFIG( (GPIO_USER_1_PORT_NUM + 1), GPIO_USER_1_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin USER 2 P4.19*/
GPIO_DEVICE_CONFIG( (GPIO_USER_2_PORT_NUM + 1), GPIO_USER_2_PIN_NUM) | GPIO_CFG_OUTPUT,
/* Output pin USER 3 P4.21*/
GPIO_DEVICE_CONFIG( (GPIO_USER_3_PORT_NUM + 1), GPIO_USER_3_PIN_NUM) | GPIO_CFG_OUTPUT
};
in the "main.cpp":
/* ON Board LED pins which are connected to GPIO pins. */
typedef enum GPIO_PIN {
GPIO_PIN_LD_PIN = 0U,
GPIO_PIN_LED0_RED,
GPIO_PIN_LED0_GREEN,
GPIO_PIN_LED0_YELLOW,
GPIO_PIN_LED1_RED,
GPIO_PIN_LED1_GREEN,
GPIO_PIN_LED1_YELLOW,
GPIO_PIN_USER1,
GPIO_PIN_USER2,
GPIO_PIN_USER3,
GPIO_PIN_COUNT
}GPIO_PIN;
to use the gpios (also leds):
GPIO_init();
GPIO_write(GPIO_PIN_LED0_RED, GPIO_PIN_VAL_LOW);
GPIO_write(GPIO_PIN_LED0_GREEN, GPIO_PIN_VAL_LOW);
GPIO_write(GPIO_PIN_LED0_YELLOW, GPIO_PIN_VAL_LOW);
//Turn all LED's off - LED 1
GPIO_write(GPIO_PIN_LED1_RED, GPIO_PIN_VAL_LOW);
GPIO_write(GPIO_PIN_LED1_GREEN, GPIO_PIN_VAL_LOW);
GPIO_write(GPIO_PIN_LED1_YELLOW, GPIO_PIN_VAL_LOW);
GPIO_write(GPIO_PIN_USER1, GPIO_PIN_VAL_HIGH);
GPIO_write(GPIO_PIN_USER2, GPIO_PIN_VAL_HIGH);
GPIO_write(GPIO_PIN_USER3, GPIO_PIN_VAL_HIGH);
The Led's are working really fine only the other 3 GPIO's (User 1,2,3) are not doing anything.
Do I have to Change the pinmux on an other file too?
Kind regard
Fkaiser