SAME70-Xplained: Has only a single LED and a single push button

This commit is contained in:
Gregory Nutt
2015-11-18 16:45:29 -06:00
parent faa9f50e53
commit 25251db103
6 changed files with 81 additions and 253 deletions
+22 -52
View File
@@ -2,7 +2,7 @@ README
====== ======
This README file discusses the port of NuttX to the Atmel SAM E70 Xplained This README file discusses the port of NuttX to the Atmel SAM E70 Xplained
Evaluation Kit (SAME70-XPLD). This board features the ATSAMV70Q21 Cortex-M7 Evaluation Kit (ATSAME70-XPLD). This board features the ATSAME70Q21 Cortex-M7
microcontroller. microcontroller.
Contents Contents
@@ -241,69 +241,39 @@ LEDs and Buttons
LEDs LEDs
---- ----
There are two yellow LED available on the SAM E70 Xplained board that can be A single LED is available driven by PC8.
turned on and off. The LEDs can be activated by driving the connected I/O
line to GND.
------ ----------- ---------------------
SAME70 Function Shared functionality
PIO
------ ----------- ---------------------
PA23 Yellow LED0 EDBG GPIO
PC09 Yellow LED1 LCD, and Shield
------ ----------- ---------------------
These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
defined. In that case, the usage by the board port is defined in defined. In that case, the usage by the board port is defined in
include/board.h and src/sam_autoleds.c. The LEDs are used to encode include/board.h and src/sam_autoleds.c. The LEDs are used to encode
OS-related events as follows: OS-related events as follows:
------------------- ----------------------- -------- -------- ------------------- ----------------------- ------
SYMBOL Meaning LED state SYMBOL Meaning LED
LED0 LED1 ------------------- ----------------------- ------
------------------- ----------------------- -------- -------- LED_STARTED NuttX has been started OFF
LED_STARTED NuttX has been started OFF OFF LED_HEAPALLOCATE Heap has been allocated OFF
LED_HEAPALLOCATE Heap has been allocated OFF OFF LED_IRQSENABLED Interrupts enabled OFF
LED_IRQSENABLED Interrupts enabled OFF OFF LED_STACKCREATED Idle stack created ON
LED_STACKCREATED Idle stack created ON OFF LED_INIRQ In an interrupt N/C
LED_INIRQ In an interrupt No change LED_SIGNAL In a signal handler N/C
LED_SIGNAL In a signal handler No change LED_ASSERTION An assertion failed N/C
LED_ASSERTION An assertion failed No change LED_PANIC The system has crashed FLASH
LED_PANIC The system has crashed N/C Blinking
LED_IDLE MCU is is sleep mode Not used
------------------- ----------------------- -------- --------
Thus if LED0 is statically on, NuttX has successfully booted and is, Thus is LED is statically on, NuttX has successfully booted and is,
apparently, running normally. If LED1 is flashing at approximately apparently, running normally. If LED is flashing at approximately
2Hz, then a fatal error has been detected and the system has halted. 2Hz, then a fatal error has been detected and the system has halted.
NOTE: That LED0 is not used after completion of booting and may
be used by other board-specific logic.
Buttons Buttons
------- -------
SAM E70 Xplained contains three mechanical buttons. One button is the RESET SAM E70 Xplained contains two mechanical buttons. One button is the RESET
button connected to the SAM E70 reset line and the others are generic user button connected to the SAM E70 reset line and the other, PA11, is a generic
configurable buttons. When a button is pressed it will drive the I/O line user configurable button. When a button is pressed it will drive the I/O
to GND. line to GND.
------ ----------- --------------------- NOTE: There are no pull-up resistors connected to the generic user buttons
SAME70 Function Shared functionality so it is necessary to enable the internal pull-up in the SAM E70 to use the
PIO button.
------ ----------- ---------------------
RESET RESET Trace, Shield, and EDBG
PA09 SW0 EDBG GPIO and Camera
PB12 SW1 EDBG SWD and Chip Erase
------ ----------- ---------------------
NOTES:
- There are no pull-up resistors connected to the generic user buttons so
it is necessary to enable the internal pull-up in the SAM E70 to use the
button.
- PB12 is set up as a system flash ERASE pin when the firmware boots. To
use the SW1, PB12 has to be configured as a normal regular I/O pin in
the MATRIX module. For more information see the SAM E70 datasheet.
AT24MAC402 Serial EEPROM AT24MAC402 Serial EEPROM
======================== ========================
+24 -58
View File
@@ -187,93 +187,59 @@
/* LED definitions ******************************************************************/ /* LED definitions ******************************************************************/
/* LEDs /* LEDs
* *
* There are two yellow LED available on the SAM E70 Xplained board that can * A single LED is available driven by PC8.
* be turned on and off. The LEDs can be activated by driving the connected
* I/O line to GND.
*
* ------ ----------- ---------------------
* SAME70 Function Shared functionality
* PIO
* ------ ----------- ---------------------
* PA23 Yellow LED0 EDBG GPIO
* PC09 Yellow LED1 LCD, and Shield
* ------ ----------- ---------------------
*
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
* way. The following definitions are used to access individual LEDs.
*/ */
/* LED index values for use with board_userled() */ /* LED index values for use with board_userled() */
#define BOARD_LED0 0 #define BOARD_LED0 0
#define BOARD_LED1 1 #define BOARD_NLEDS 1
#define BOARD_NLEDS 2
/* LED bits for use with board_userled_all() */ /* LED bits for use with board_userled_all() */
#define BOARD_LED0_BIT (1 << BOARD_LED0) #define BOARD_LED0_BIT (1 << BOARD_LED0)
#define BOARD_LED1_BIT (1 << BOARD_LED1)
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is /* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in * defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode * include/board.h and src/sam_autoleds.c. The LEDs are used to encode
* OS-related events as follows: * OS-related events as follows:
* *
* SYMBOL Meaning LED state * ------------------- ---------------------------- ------
* LED2 LED1 * SYMBOL Meaning LED
* ------------------------ -------------------------- ------ ------ */ * ------------------- ---------------------------- ------ */
#define LED_STARTED 0 /* NuttX has been started OFF OFF */ #define LED_STARTED 0 /* NuttX has been started OFF */
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF */
#define LED_STACKCREATED 1 /* Idle stack created ON OFF */ #define LED_STACKCREATED 1 /* Idle stack created ON */
#define LED_INIRQ 2 /* In an interrupt No change */ #define LED_INIRQ 2 /* In an interrupt N/C */
#define LED_SIGNAL 2 /* In a signal handler No change */ #define LED_SIGNAL 2 /* In a signal handler N/C */
#define LED_ASSERTION 2 /* An assertion failed No change */ #define LED_ASSERTION 2 /* An assertion failed N/C */
#define LED_PANIC 3 /* The system has crashed N/C Blinking */ #define LED_PANIC 3 /* The system has crashed FLASH */
#undef LED_IDLE /* MCU is is sleep mode Not used */ #undef LED_IDLE /* MCU is is sleep mode Not used */
/* Thus if LED0 is statically on, NuttX has successfully booted and is, /* Thus is LED is statically on, NuttX has successfully booted and is,
* apparently, running normally. If LED1 is flashing at approximately * apparently, running normally. If LED is flashing at approximately
* 2Hz, then a fatal error has been detected and the system has halted. * 2Hz, then a fatal error has been detected and the system has halted.
*
* NOTE: That LED0 is not used after completion of booting and may
* be used by other board-specific logic.
*/ */
/* Button definitions ***************************************************************/ /* Button definitions ***************************************************************/
/* Buttons /* Buttons
* *
* SAM E70 Xplained contains three mechanical buttons. One button is the RESET * SAM E70 Xplained contains two mechanical buttons. One button is the RESET
* button connected to the SAM E70 reset line and the others are generic user * button connected to the SAM E70 reset line and the other, PA11, is a generic
* configurable buttons. When a button is pressed it will drive the I/O line * user configurable button. When a button is pressed it will drive the I/O
* to GND. * line to GND.
* *
* ------ ----------- --------------------- * NOTE: There are no pull-up resistors connected to the generic user buttons
* SAME70 Function Shared functionality * so it is necessary to enable the internal pull-up in the SAM E70 to use the
* PIO * button.
* ------ ----------- ---------------------
* RESET RESET Trace, Shield, and EDBG
* PA09 SW0 EDBG GPIO and Camera
* PB12 SW1 EDBG SWD and Chip Erase
* ------ ----------- ---------------------
*
* NOTES:
*
* - There are no pull-up resistors connected to the generic user buttons so
* it is necessary to enable the internal pull-up in the SAM E70 to use the
* button.
* - PB12 is set up as a system flash ERASE pin when the firmware boots. To
* use the SW1, PB12 has to be configured as a normal regular I/O pin in
* the MATRIX module. For more information see the SAM E70 datasheet.
*/ */
#define BUTTON_SW0 0 #define BUTTON_SW0 0
#define BUTTON_SW1 1 #define NUM_BUTTONS 1
#define NUM_BUTTONS 2
#define BUTTON_SW0_BIT (1 << BUTTON_SW0) #define BUTTON_SW0_BIT (1 << BUTTON_SW0)
#define BUTTON_SW1_BIT (1 << BUTTON_SW1)
/* PIO Disambiguation ***************************************************************/ /* PIO Disambiguation ***************************************************************/
/* Serial Console /* Serial Console
+17 -47
View File
@@ -35,44 +35,28 @@
/* LEDs /* LEDs
* *
* There are two yellow LED available on the SAM E70 Xplained board that * A single LED is available driven by PC8.
* can be turned on and off. The LEDs can be activated by driving the
* connected I/O line to GND.
*
* ------ ----------- ---------------------
* SAME70 Function Shared functionality
* PIO
* ------ ----------- ---------------------
* PA23 Yellow LED0 EDBG GPIO
* PC09 Yellow LED1 LCD, and Shield
* ------ ----------- ---------------------
* *
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is * These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in * defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode * include/board.h and src/sam_autoleds.c. The LEDs are used to encode
* OS-related events as follows: * OS-related events as follows:
* *
* ------------------- ----------------------- -------- -------- * ------------------- ----------------------- ------
* SYMBOL Meaning LED state * SYMBOL Meaning LED
* LED0 LED1 * ------------------- ----------------------- ------
* ------------------- ----------------------- -------- -------- * LED_STARTED NuttX has been started OFF
* LED_STARTED NuttX has been started OFF OFF * LED_HEAPALLOCATE Heap has been allocated OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF * LED_IRQSENABLED Interrupts enabled OFF
* LED_IRQSENABLED Interrupts enabled OFF OFF * LED_STACKCREATED Idle stack created ON
* LED_STACKCREATED Idle stack created ON OFF * LED_INIRQ In an interrupt N/C
* LED_INIRQ In an interrupt No change * LED_SIGNAL In a signal handler N/C
* LED_SIGNAL In a signal handler No change * LED_ASSERTION An assertion failed N/C
* LED_ASSERTION An assertion failed No change * LED_PANIC The system has crashed FLASH
* LED_PANIC The system has crashed N/C Blinking
* LED_IDLE MCU is is sleep mode Not used
* ------------------- ----------------------- -------- --------
* *
* Thus if LED0 is statically on, NuttX has successfully booted and is, * Thus is LED is statically on, NuttX has successfully booted and is,
* apparently, running normally. If LED1 is flashing at approximately * apparently, running normally. If LED is flashing at approximately
* 2Hz, then a fatal error has been detected and the system has halted. * 2Hz, then a fatal error has been detected and the system has halted.
*
* NOTE: That LED0 is not used after completion of booting and may
* be used by other board-specific logic.
*/ */
/**************************************************************************** /****************************************************************************
@@ -130,7 +114,6 @@ void board_autoled_initialize(void)
/* Configure LED PIOs for output */ /* Configure LED PIOs for output */
sam_configgpio(GPIO_LED0); sam_configgpio(GPIO_LED0);
sam_configgpio(GPIO_LED1);
} }
/**************************************************************************** /****************************************************************************
@@ -139,22 +122,9 @@ void board_autoled_initialize(void)
void board_autoled_on(int led) void board_autoled_on(int led)
{ {
switch (led) if (led == 1 || led == 3)
{ {
case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED */ sam_gpiowrite(GPIO_LED0, false); /* Low illuminates */
break;
case 1: /* LED_STACKCREATED */
sam_gpiowrite(GPIO_LED0, false); /* Low illuminates */
break;
default:
case 2: /* LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
return;
case 3: /* LED_PANIC */
sam_gpiowrite(GPIO_LED1, false); /* Low illuminates */
break;
} }
} }
@@ -166,7 +136,7 @@ void board_autoled_off(int led)
{ {
if (led == 3) if (led == 3)
{ {
sam_gpiowrite(GPIO_LED1, true); /* High extinguishes */ sam_gpiowrite(GPIO_LED0, true); /* High extinguishes */
} }
} }
+6 -40
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/sam4e-ek/src/sam_buttons.c * configs/sam4e-ek/src/sam_buttons.c
* *
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -66,16 +66,13 @@
#ifdef CONFIG_ARCH_IRQBUTTONS #ifdef CONFIG_ARCH_IRQBUTTONS
#define HAVE_IRQBUTTONS 1 #define HAVE_IRQBUTTONS 1
#if !defined(CONFIG_SAMV7_GPIOA_IRQ) && !defined(CONFIG_SAMV7_GPIOB_IRQ) #ifndef CONFIG_SAMV7_GPIOA_IRQ
# undef HAVE_IRQBUTTONS # undef HAVE_IRQBUTTONS
#endif #endif
#ifdef CONFIG_SAMV7_GPIOA_IRQ #ifdef CONFIG_SAMV7_GPIOA_IRQ
static xcpt_t g_irq_sw0; static xcpt_t g_irq_sw0;
#endif #endif
#ifdef CONFIG_SAMV7_GPIOB_IRQ
static xcpt_t g_irq_sw1;
#endif
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -151,21 +148,9 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
void board_button_initialize(void) void board_button_initialize(void)
{ {
uint32_t regval;
/* PB12 is set up as a system flash ERASE pin when the firmware boots. To
* use the SW1, PB12 has to be configured as a normal regular I/O pin in
* the MATRIX module. For more information see the SAM E70 datasheet.
*/
regval = getreg32(SAM_MATRIX_CCFG_SYSIO);
regval |= MATRIX_CCFG_SYSIO_SYSIO12;
putreg32(regval, SAM_MATRIX_CCFG_SYSIO);
/* Configure button PIOs */ /* Configure button PIOs */
(void)sam_configgpio(GPIO_SW0); (void)sam_configgpio(GPIO_SW0);
(void)sam_configgpio(GPIO_SW1);
} }
/**************************************************************************** /****************************************************************************
@@ -181,12 +166,7 @@ void board_button_initialize(void)
uint8_t board_buttons(void) uint8_t board_buttons(void)
{ {
uint8_t retval; return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
retval = sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
retval |= sam_gpioread(GPIO_SW1) ? 0 : BUTTON_SW1_BIT;
return retval;
} }
/**************************************************************************** /****************************************************************************
@@ -211,28 +191,14 @@ uint8_t board_buttons(void)
xcpt_t board_button_irq(int id, xcpt_t irqhandler) xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{ {
#ifdef HAVE_IRQBUTTONS #ifdef HAVE_IRQBUTTONS
if (id == BUTTON_SW0)
switch (id)
{ {
#ifdef CONFIG_SAMV7_GPIOA_IRQ return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0);
case BUTTON_SW0:
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0);
#endif
#ifdef CONFIG_SAMV7_GPIOB_IRQ
case BUTTON_SW1:
return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1);
#endif
default:
return NULL;
} }
#endif
#else
return NULL; return NULL;
#endif
} }
#endif #endif
+2 -16
View File
@@ -69,7 +69,6 @@ void board_userled_initialize(void)
/* Configure LED PIOs for output */ /* Configure LED PIOs for output */
sam_configgpio(GPIO_LED0); sam_configgpio(GPIO_LED0);
sam_configgpio(GPIO_LED1);
} }
/**************************************************************************** /****************************************************************************
@@ -78,22 +77,10 @@ void board_userled_initialize(void)
void board_userled(int led, bool ledon) void board_userled(int led, bool ledon)
{ {
uint32_t ledcfg;
if (led == BOARD_LED0) if (led == BOARD_LED0)
{ {
ledcfg = GPIO_LED0; sam_gpiowrite(GPIO_LED0, !ledon); /* Low illuminates */
} }
else if (led == BOARD_LED1)
{
ledcfg = GPIO_LED1;
}
else
{
return;
}
sam_gpiowrite(ledcfg, !ledon); /* Low illuminates */
} }
/**************************************************************************** /****************************************************************************
@@ -104,6 +91,5 @@ void board_userled_all(uint8_t ledset)
{ {
/* Low illuminates */ /* Low illuminates */
sam_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) == 0); sam_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) == 0));
sam_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
} }
+10 -40
View File
@@ -228,57 +228,27 @@
/* LEDs /* LEDs
* *
* There are two yellow LED available on the SAM E70 Xplained board that can * A single LED is available driven by PC8.
* be turned on and off. The LEDs can be activated by driving the connected
* I/O line to GND.
*
* ------ ----------- ---------------------
* SAME70 Function Shared functionality
* PIO
* ------ ----------- ---------------------
* PA23 Yellow LED0 EDBG GPIO
* PC09 Yellow LED1 LCD, and Shield
* ------ ----------- ---------------------
*/ */
#define GPIO_LED0 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ #define GPIO_LED0 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOA | GPIO_PIN23) GPIO_PORT_PIOC | GPIO_PIN8)
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOC | GPIO_PIN9)
/* Buttons /* Buttons
* *
* SAM E70 Xplained contains three mechanical buttons. One button is the * SAM E70 Xplained contains two mechanical buttons. One button is the RESET
* RESET button connected to the SAME70 reset line and the others are generic * button connected to the SAM E70 reset line and the other, PA11, is a generic
* user configurable buttons. When a button is pressed it will drive the I/O * user configurable button. When a button is pressed it will drive the I/O
* line to GND. * line to GND.
* *
* ------ ----------- --------------------- * NOTE: There are no pull-up resistors connected to the generic user buttons
* SAME70 Function Shared functionality * so it is necessary to enable the internal pull-up in the SAM E70 to use the
* PIO * button.
* ------ ----------- ---------------------
* RESET RESET Trace, Shield, and EDBG
* PA09 SW0 EDBG GPIO and Camera
* PB12 SW1 EDBG SWD and Chip Erase
* ------ ----------- ---------------------
*
* NOTES:
*
* - There are no pull-up resistors connected to the generic user buttons so
* it is necessary to enable the internal pull-up in the SAM E70 to use the
* button.
* - PB12 is set up as a system flash ERASE pin when the firmware boots. To
* use the SW1, PB12 has to be configured as a normal regular I/O pin in
* the MATRIX module. For more information see the SAM E70 datasheet.
*/ */
#define GPIO_SW0 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \ #define GPIO_SW0 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN9) GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN11)
#define GPIO_SW1 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \ #define IRQ_SW0 SAM_IRQ_PA11
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOB | GPIO_PIN12)
#define IRQ_SW0 SAM_IRQ_PA9
#define IRQ_SW1 SAM_IRQ_PB12
/* HSMCI SD Card Detect /* HSMCI SD Card Detect
* *