Merged nuttx/boards into master

This commit is contained in:
Marawan Ragab
2015-11-22 13:26:03 -05:00
7 changed files with 296 additions and 101 deletions
+4
View File
@@ -78,4 +78,8 @@ ifeq ($(CONFIG_TIMER),y)
CSRCS += stm32_timer.c CSRCS += stm32_timer.c
endif endif
ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y)
CSRCS += stm32_uid.c
endif
include $(TOPDIR)/configs/Board.mk include $(TOPDIR)/configs/Board.mk
+70
View File
@@ -0,0 +1,70 @@
/************************************************************************************
* configs/nucleo-f303re/src/stm32_uid.c
*
* Copyright (C) 2015 Marawan Ragab. All rights reserved.
* Author: Marawan Ragab <marawan31@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include "stm32_uid.h"
#include <nuttx/board.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
#ifndef OK
# define OK 0
#endif
/************************************************************************************
* Public Functions
************************************************************************************/
#if defined(CONFIG_BOARDCTL_UNIQUEID)
int board_uniqueid(uint8_t *uniqueid)
{
if (uniqueid == 0)
{
return -EINVAL;
}
stm32_get_uniqueid(uniqueid);
return OK;
}
#endif
+78 -65
View File
@@ -25,7 +25,21 @@ Contents
Status/Open Issues Status/Open Issues
================== ==================
To be provided Although this configuration is not particualarly different from the
SAMV71-XULT board, my initial attempts to debug the board have not been
successful. The code is just not behaving correctly in excuting the first
few instructions after reset. I have very early realease boards and I am
suspected some tool/board issue: It appears that I write the code
correctly to FLASH and the GPNVM is configured so that the FLASH lies at
address 0x00000000, but trying to step through with AtmelStudio 7 results
in uninterpretble behavior. Using the Segger J-Link, I get errors trying
to reset and halt the board so I am unable to use that debugger either.
WARNING: This README derives heavily from the SAMV71-XULT README file and
may still contain some logic that pertains only to that board. This is a
work in progress
See also configs/samv71-xult/README.txt
Serial Console Serial Console
============== ==============
@@ -42,8 +56,8 @@ use either the VCOM or an external RS-232 driver. Here are some options.
Pin on SAME70 Arduino Arduino SAME70 Pin on SAME70 Arduino Arduino SAME70
J503 PIO Name Pin Function J503 PIO Name Pin Function
------ ------ ------- ------- -------- ------ ------ ------- ------- --------
1 PD28 RX0 0 URXD3 1 PD28 D0/RX0 0 URXD3
2 PD30 TX0 1 UTXD3 2 PD30 D1/TX0 1 UTXD3
------ ------ ------- ------- -------- ------ ------ ------- ------- --------
In this configuration, an external RS232 driver can also be used In this configuration, an external RS232 driver can also be used
@@ -60,47 +74,49 @@ use either the VCOM or an external RS-232 driver. Here are some options.
--------- ----------- --------- -----------
- Arduino Communications. Additional UART/USART connections are available - Arduino Communications. Additional UART/USART connections are available
on the Arduino Communications connection J505: on the Arduino Communications connection J505 and J507:
------ ------ ------- ------- -------- --------- ---------- --------------------------------
Pin on SAME70 Arduino Arduino SAME70 Connector SAME70 Pin Description
J503 PIO Name Pin Function --------- ---------- --------------------------------
------ ------ ------- ------- -------- J503 1 URXD3 PD28 Standard Arduino serial (D0/RXD)
3 PD18 RX1 0 URXD4 J503 2 UTXD3 PD30 Standard Arduino serial (D1/TXD)
4 PD19 TX1 0 UTXD4 --------- ---------- --------------------------------
5 PD15 RX2 0 RXD2 J505 3 URXD4 PD18 Arduino D19
6 PD16 TX2 0 TXD2 J505 4 UTXD4 PD19 Arduino D18
7 PB0 RX3 0 RXD0 J505 5 RXD2 PD15 Arduino D17
8 PB1 TX3 1 TXD0 J505 6 TXD2 PD16 Arduino D16
------ ------ ------- ------- -------- J505 7 RXD0 PB0 Arduino D15
J505 8 TXD0 PB1 Arduino D14
--------- ---------- --------------------------------
J507 27 RXD1 PA21 Arduino D46
J507 28 TXD1 PB4 Arduino D47
--------- ---------- --------------------------------
- SAMV7-XULT EXTn connectors. USART pins are also available the EXTn - SAMV7-XULT EXTn connectors. USART pins are also available the EXTn
connectors. The following are labelled in the User Guide for USART connectors. The following are labelled in the User Guide for USART
functionality: functionality:
---- -------- ------ -------- SAME70 Xplained Connectors
EXT1 EXTI1 SAME70 SAME70 --------- ---------- --------------------------------
Pin Name PIO Function Connector SAME70 Pin Description
---- -------- ------ -------- --------- ---------- --------------------------------
13 USART_RX PB00 RXD0 J401 13 RXD0 PB0 EXT1 UART_RX
14 USART_TX PB01 TXD0 J401 14 TXD0 PB1 EXT1 UART_7X
--------- ---------- --------------------------------
---- -------- ------ -------- J402 13 RXD1 PA21 EXT2 UART_RX
EXT2 EXTI2 SAME70 SAME70 J402 14 TXD1 PB4 EXT2 UART_TX
Pin Name PIO Function --------- ---------- --------------------------------
---- -------- ------ --------
13 USART_RX PA21 RXD1
14 USART_TX PB04 TXD1
- VCOM. The Virtual Com Port gateway is available on USART1: - VCOM. The Virtual Com Port gateway is available on USART1:
------ -------- EDBG VCOM Interface
SAME70 SAME70 ---------------- --------- --------------------------
PIO Function EDBG Singal SAME70
------ -------- ---------------- --------- --------------------------
PB04 TXD1 EDBG_CDC_UART_RX TXD1 PB4
PA21 RXD1 EDBG_CDC_UART_TX RXD1 PA21
------ -------- ---------------- --------- --------------------------
Any of these options can be selected as the serial console by: Any of these options can be selected as the serial console by:
@@ -286,15 +302,13 @@ contains a MAC address for use with the Ethernet interface.
Connectivity: Connectivity:
------ -------- -------- ------------------------------------------ ------ -------- --------
SAME70 SAME70 I2C Shared SAME70 SAME70 I2C
Pin Function Function Functionality Pin Function Function
------ -------- -------- ------------------------------------------ ------ -------- --------
PA03 TWID0 SDA EXT1, EXT2, EDBG I2C, LCD, Camera, and PA03 TWID0 SDA
Shield PA04 TWICK0 SCL
PA04 TWICK0 SCL EXT1, EXT2, EDBG I2C, LCD, Camera, and, ------ -------- --------
Shield
------ -------- -------- ------------------------------------------
I2C address: I2C address:
@@ -329,27 +343,26 @@ The configuration data device will appear at /dev/config.
Networking Networking
========== ==========
KSZ8061RNBVA Connections KSZ8081RNACA Connections
------------------------ ------------------------
------ --------- --------- -------------------------- ------ --------- ---------
SAME70 SAME70 Ethernet Shared functionality SAME70 SAME70 Ethernet
Pin Function Function Pin Function Functio
------ --------- --------- -------------------------- ------ --------- ---------
PD00 GTXCK REF_CLK Shield PD0 GTXCK REF_CLK
PD01 GTXEN TXEN PD1 GTXEN TXEN
PD02 GTX0 TXD0 PD2 GTX0 TXD0
PD03 GTX1 TXD1 PD3 GTX1 TXD1
PD04 GRXDV CRS_DV Trace PD4 GRXDV CRS_DV
PD05 GRX0 RXD0 Trace PD5 GRX0 RXD0
PD06 GRX1 RXD1 Trace PD6 GRX1 RXD1
PD07 GRXER RXER Trace PD7 GRXER RXER
PD08 GMDC MDC Trace PD8 GMDC MDC
PD09 GMDIO MDIO PD9 GMDIO MDIO
PA19 GPIO INTERRUPT EXT1, Shield PA14 GPIO INTERRUPT
PA29 GPIO SIGDET
PC10 GPIO RESET PC10 GPIO RESET
------ --------- --------- -------------------------- ------ --------- ---------
Selecting the GMAC peripheral Selecting the GMAC peripheral
----------------------------- -----------------------------
@@ -1127,9 +1140,9 @@ Configuration sub-directories
NOTES: NOTES:
1. The serial console is configured by default for use with and Arduino 1. The serial console is configured by default for use with the EDBG VCOM
serial shield (UART3). You will need to reconfigure if you will (USART1). You will need to reconfigure if you will to use a different
to use a different U[S]ART. U[S]ART.
2. Default stack sizes are large and should really be tuned to reduce 2. Default stack sizes are large and should really be tuned to reduce
the RAM footprint: the RAM footprint:
+17 -15
View File
@@ -245,12 +245,12 @@ CONFIG_SAMV7_TWIHS0=y
# CONFIG_SAMV7_UART0 is not set # CONFIG_SAMV7_UART0 is not set
# CONFIG_SAMV7_UART1 is not set # CONFIG_SAMV7_UART1 is not set
# CONFIG_SAMV7_UART2 is not set # CONFIG_SAMV7_UART2 is not set
CONFIG_SAMV7_UART3=y # CONFIG_SAMV7_UART3 is not set
# CONFIG_SAMV7_UART4 is not set # CONFIG_SAMV7_UART4 is not set
# CONFIG_SAMV7_USBDEVHS is not set # CONFIG_SAMV7_USBDEVHS is not set
# CONFIG_SAMV7_USBHOSTHS is not set # CONFIG_SAMV7_USBHOSTHS is not set
# CONFIG_SAMV7_USART0 is not set # CONFIG_SAMV7_USART0 is not set
# CONFIG_SAMV7_USART1 is not set CONFIG_SAMV7_USART1=y
# CONFIG_SAMV7_USART2 is not set # CONFIG_SAMV7_USART2 is not set
# CONFIG_SAMV7_WDT0 is not set # CONFIG_SAMV7_WDT0 is not set
# CONFIG_SAMV7_WDT1 is not set # CONFIG_SAMV7_WDT1 is not set
@@ -583,7 +583,7 @@ CONFIG_SERIAL=y
# CONFIG_ARCH_HAVE_UART0 is not set # CONFIG_ARCH_HAVE_UART0 is not set
# CONFIG_ARCH_HAVE_UART1 is not set # CONFIG_ARCH_HAVE_UART1 is not set
# CONFIG_ARCH_HAVE_UART2 is not set # CONFIG_ARCH_HAVE_UART2 is not set
CONFIG_ARCH_HAVE_UART3=y # CONFIG_ARCH_HAVE_UART3 is not set
# CONFIG_ARCH_HAVE_UART4 is not set # CONFIG_ARCH_HAVE_UART4 is not set
# CONFIG_ARCH_HAVE_UART5 is not set # CONFIG_ARCH_HAVE_UART5 is not set
# CONFIG_ARCH_HAVE_UART6 is not set # CONFIG_ARCH_HAVE_UART6 is not set
@@ -592,7 +592,7 @@ CONFIG_ARCH_HAVE_UART3=y
# CONFIG_ARCH_HAVE_SCI0 is not set # CONFIG_ARCH_HAVE_SCI0 is not set
# CONFIG_ARCH_HAVE_SCI1 is not set # CONFIG_ARCH_HAVE_SCI1 is not set
# CONFIG_ARCH_HAVE_USART0 is not set # CONFIG_ARCH_HAVE_USART0 is not set
# CONFIG_ARCH_HAVE_USART1 is not set CONFIG_ARCH_HAVE_USART1=y
# CONFIG_ARCH_HAVE_USART2 is not set # CONFIG_ARCH_HAVE_USART2 is not set
# CONFIG_ARCH_HAVE_USART3 is not set # CONFIG_ARCH_HAVE_USART3 is not set
# CONFIG_ARCH_HAVE_USART4 is not set # CONFIG_ARCH_HAVE_USART4 is not set
@@ -605,28 +605,30 @@ CONFIG_ARCH_HAVE_UART3=y
# #
# USART Configuration # USART Configuration
# #
CONFIG_USART1_ISUART=y
CONFIG_MCU_SERIAL=y CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y CONFIG_STANDARD_SERIAL=y
# CONFIG_SERIAL_IFLOWCONTROL is not set # CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set # CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_SERIAL_DMA is not set # CONFIG_SERIAL_DMA is not set
CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y
CONFIG_UART3_SERIAL_CONSOLE=y CONFIG_USART1_SERIAL_CONSOLE=y
# CONFIG_UART3_SERIAL_CONSOLE is not set
# CONFIG_OTHER_SERIAL_CONSOLE is not set # CONFIG_OTHER_SERIAL_CONSOLE is not set
# CONFIG_NO_SERIAL_CONSOLE is not set # CONFIG_NO_SERIAL_CONSOLE is not set
# #
# UART3 Configuration # USART1 Configuration
# #
CONFIG_UART3_RXBUFSIZE=256 CONFIG_USART1_RXBUFSIZE=256
CONFIG_UART3_TXBUFSIZE=256 CONFIG_USART1_TXBUFSIZE=256
CONFIG_UART3_BAUD=115200 CONFIG_USART1_BAUD=115200
CONFIG_UART3_BITS=8 CONFIG_USART1_BITS=8
CONFIG_UART3_PARITY=0 CONFIG_USART1_PARITY=0
CONFIG_UART3_2STOP=0 CONFIG_USART1_2STOP=0
# CONFIG_UART3_IFLOWCONTROL is not set # CONFIG_USART1_IFLOWCONTROL is not set
# CONFIG_UART3_OFLOWCONTROL is not set # CONFIG_USART1_OFLOWCONTROL is not set
# CONFIG_UART3_DMA is not set # CONFIG_USART1_DMA is not set
# CONFIG_USBDEV is not set # CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set # CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set # CONFIG_WIRELESS is not set
+18 -21
View File
@@ -194,33 +194,30 @@
/* Ethernet MAC. /* Ethernet MAC.
* *
* KSZ8061RNBVA Connections * KSZ8081RNACA Connections
* ------------------------ * ------------------------
* *
* ------ --------- --------- -------------------------- * ------ --------- ---------
* SAME70 SAME70 Ethernet Shared functionality * SAME70 SAME70 Ethernet
* Pin Function Function * Pin Function Functio
* ------ --------- --------- -------------------------- * ------ --------- ---------
* PD00 GTXCK REF_CLK Shield * PD0 GTXCK REF_CLK
* PD01 GTXEN TXEN * PD1 GTXEN TXEN
* PD02 GTX0 TXD0 * PD2 GTX0 TXD0
* PD03 GTX1 TXD1 * PD3 GTX1 TXD1
* PD04 GRXDV CRS_DV Trace * PD4 GRXDV CRS_DV
* PD05 GRX0 RXD0 Trace * PD5 GRX0 RXD0
* PD06 GRX1 RXD1 Trace * PD6 GRX1 RXD1
* PD07 GRXER RXER Trace * PD7 GRXER RXER
* PD08 GMDC MDC Trace * PD8 GMDC MDC
* PD09 GMDIO MDIO * PD9 GMDIO MDIO
* PA19 GPIO INTERRUPT EXT1, Shield * PA14 GPIO INTERRUPT
* PA29 GPIO SIGDET
* PC10 GPIO RESET * PC10 GPIO RESET
* ------ --------- --------- -------------------------- * ------ --------- ---------
*/ */
#define GPIO_EMAC0_INT (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \ #define GPIO_EMAC0_INT (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_FALLING | GPIO_PORT_PIOA | GPIO_PIN19) GPIO_INT_FALLING | GPIO_PORT_PIOA | GPIO_PIN14)
#define GPIO_EMAC0_SIGDET (GPIO_INPUT | GPIO_CFG_DEFAULT | \
GPIO_PORT_PIOA | GPIO_PIN29)
#define GPIO_EMAC0_RESET (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ #define GPIO_EMAC0_RESET (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOC | GPIO_PIN10) GPIO_PORT_PIOC | GPIO_PIN10)
+65
View File
@@ -70,6 +70,17 @@
# include "sam_progmem.h" # include "sam_progmem.h"
#endif #endif
#if defined(HAVE_RTC_DSXXXX) || defined(HAVE_RTC_PCF85263)
# include <nuttx/clock.h>
# include <nuttx/i2c.h>
#ifdef HAVE_RTC_DSXXXX
# include <nuttx/timers/ds3231.h>
#else
# include <nuttx/timers/pcf85263.h>
#endif
# include "sam_twihs.h"
#endif
#ifdef HAVE_ROMFS #ifdef HAVE_ROMFS
# include <arch/board/boot_romfsimg.h> # include <arch/board/boot_romfsimg.h>
#endif #endif
@@ -110,12 +121,66 @@ int sam_bringup(void)
#if defined(HAVE_S25FL1) || defined(HAVE_PROGMEM_CHARDEV) #if defined(HAVE_S25FL1) || defined(HAVE_PROGMEM_CHARDEV)
FAR struct mtd_dev_s *mtd; FAR struct mtd_dev_s *mtd;
#endif #endif
#if defined(HAVE_RTC_DSXXXX) || defined(HAVE_RTC_PCF85263)
FAR struct i2c_dev_s *i2c;
#endif
#if defined(HAVE_S25FL1_CHARDEV) || defined(HAVE_PROGMEM_CHARDEV) #if defined(HAVE_S25FL1_CHARDEV) || defined(HAVE_PROGMEM_CHARDEV)
char blockdev[18]; char blockdev[18];
char chardev[12]; char chardev[12];
#endif #endif
int ret; int ret;
#if defined(HAVE_RTC_PCF85263)
/* Get an instance of the TWIHS0 I2C interface */
i2c = up_i2cinitialize(PCF85263_TWI_BUS);
if (i2c == NULL)
{
SYSLOG("ERROR: up_i2cinitialize(%d) failed\n", PCF85263_TWI_BUS);
}
else
{
/* Use the I2C interface to initialize the PCF2863 timer */
ret = pcf85263_rtc_initialize(i2c);
if (ret < 0)
{
SYSLOG("ERROR: pcf85263_rtc_initialize() failed: %d\n", ret);
}
else
{
/* Synchronize the system time to the RTC time */
clock_synchronize();
}
}
#else /* if defined(HAVE_RTC_DSXXXX) */
/* Get an instance of the TWIHS0 I2C interface */
i2c = up_i2cinitialize(DSXXXX_TWI_BUS);
if (i2c == NULL)
{
SYSLOG("ERROR: up_i2cinitialize(%d) failed\n", DSXXXX_TWI_BUS);
}
else
{
/* Use the I2C interface to initialize the DSXXXX timer */
ret = dsxxxx_rtc_initialize(i2c);
if (ret < 0)
{
SYSLOG("ERROR: dsxxxx_rtc_initialize() failed: %d\n", ret);
}
else
{
/* Synchronize the system time to the RTC time */
clock_synchronize();
}
}
#endif
#ifdef HAVE_MACADDR #ifdef HAVE_MACADDR
/* Read the Ethernet MAC address from the AT24 FLASH and configure the /* Read the Ethernet MAC address from the AT24 FLASH and configure the
* Ethernet driver with that address. * Ethernet driver with that address.
+44
View File
@@ -68,6 +68,8 @@
#define HAVE_PROGMEM_CHARDEV 1 #define HAVE_PROGMEM_CHARDEV 1
#define HAVE_WM8904 1 #define HAVE_WM8904 1
#define HAVE_AUDIO_NULL 1 #define HAVE_AUDIO_NULL 1
#define HAVE_RTC_DSXXXX 1
#define HAVE_RTC_PCF85263 1
/* HSMCI */ /* HSMCI */
/* Can't support MMC/SD if the card interface is not enabled */ /* Can't support MMC/SD if the card interface is not enabled */
@@ -298,6 +300,48 @@
# endif # endif
#endif #endif
/* DS3231/DS1307 RTC
*
* For testing purposes, I have connected Maximum Integrated DS1307 and NXP
* PCF85263 I2C RTC TWIHS0 (available on either EXT or EXT2 pins 11 and 12).
*/
#ifndef CONFIG_RTC_DSXXXX
# undef HAVE_RTC_DSXXXX
#endif
#ifndef CONFIG_RTC_PCF85263
# undef HAVE_RTC_PCF85263
#endif
#ifndef CONFIG_SAMV7_TWIHS0
# undef HAVE_RTC_DSXXXX
# undef HAVE_RTC_PCF85263
#endif
#if !defined(CONFIG_RTC) || !defined(CONFIG_RTC_DATETIME)
# undef HAVE_RTC_DSXXXX
# undef HAVE_RTC_PCF85263
#endif
#if defined(HAVE_RTC_DSXXXX) && defined(HAVE_RTC_PCF85263)
# undef HAVE_RTC_DSXXXX
#endif
#ifdef HAVE_RTC_DSXXXX
/* The DS3231/1307 RTC communicates on TWI0, I2C address 0x68 */
# define DSXXXX_TWI_BUS 0
# define DSXXXX_I2C_ADDRESS 0x68
#endif
#ifdef HAVE_RTC_PCF85263
/* The PCF85263 RTC communicates on TWI0, I2C address 0x51 */
# define PCF85263_TWI_BUS 0
# define PCF85263_I2C_ADDRESS 0x51
#endif
/* SAMV71-XULT GPIO Pin Definitions *************************************************/ /* SAMV71-XULT GPIO Pin Definitions *************************************************/
/* Ethernet MAC. /* Ethernet MAC.