Merged nuttx/boards into master

This commit is contained in:
Marawan Ragab 2015-11-22 13:26:03 -05:00
commit 79e89e04d1
7 changed files with 296 additions and 101 deletions

View File

@ -78,4 +78,8 @@ ifeq ($(CONFIG_TIMER),y)
CSRCS += stm32_timer.c
endif
ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y)
CSRCS += stm32_uid.c
endif
include $(TOPDIR)/configs/Board.mk

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

View File

@ -25,7 +25,21 @@ Contents
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
==============
@ -42,8 +56,8 @@ use either the VCOM or an external RS-232 driver. Here are some options.
Pin on SAME70 Arduino Arduino SAME70
J503 PIO Name Pin Function
------ ------ ------- ------- --------
1 PD28 RX0 0 URXD3
2 PD30 TX0 1 UTXD3
1 PD28 D0/RX0 0 URXD3
2 PD30 D1/TX0 1 UTXD3
------ ------ ------- ------- --------
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
on the Arduino Communications connection J505:
on the Arduino Communications connection J505 and J507:
------ ------ ------- ------- --------
Pin on SAME70 Arduino Arduino SAME70
J503 PIO Name Pin Function
------ ------ ------- ------- --------
3 PD18 RX1 0 URXD4
4 PD19 TX1 0 UTXD4
5 PD15 RX2 0 RXD2
6 PD16 TX2 0 TXD2
7 PB0 RX3 0 RXD0
8 PB1 TX3 1 TXD0
------ ------ ------- ------- --------
--------- ---------- --------------------------------
Connector SAME70 Pin Description
--------- ---------- --------------------------------
J503 1 URXD3 PD28 Standard Arduino serial (D0/RXD)
J503 2 UTXD3 PD30 Standard Arduino serial (D1/TXD)
--------- ---------- --------------------------------
J505 3 URXD4 PD18 Arduino D19
J505 4 UTXD4 PD19 Arduino D18
J505 5 RXD2 PD15 Arduino D17
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
connectors. The following are labelled in the User Guide for USART
functionality:
---- -------- ------ --------
EXT1 EXTI1 SAME70 SAME70
Pin Name PIO Function
---- -------- ------ --------
13 USART_RX PB00 RXD0
14 USART_TX PB01 TXD0
---- -------- ------ --------
EXT2 EXTI2 SAME70 SAME70
Pin Name PIO Function
---- -------- ------ --------
13 USART_RX PA21 RXD1
14 USART_TX PB04 TXD1
SAME70 Xplained Connectors
--------- ---------- --------------------------------
Connector SAME70 Pin Description
--------- ---------- --------------------------------
J401 13 RXD0 PB0 EXT1 UART_RX
J401 14 TXD0 PB1 EXT1 UART_7X
--------- ---------- --------------------------------
J402 13 RXD1 PA21 EXT2 UART_RX
J402 14 TXD1 PB4 EXT2 UART_TX
--------- ---------- --------------------------------
- VCOM. The Virtual Com Port gateway is available on USART1:
------ --------
SAME70 SAME70
PIO Function
------ --------
PB04 TXD1
PA21 RXD1
------ --------
EDBG VCOM Interface
---------------- --------- --------------------------
EDBG Singal SAME70
---------------- --------- --------------------------
EDBG_CDC_UART_RX TXD1 PB4
EDBG_CDC_UART_TX RXD1 PA21
---------------- --------- --------------------------
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:
------ -------- -------- ------------------------------------------
SAME70 SAME70 I2C Shared
Pin Function Function Functionality
------ -------- -------- ------------------------------------------
PA03 TWID0 SDA EXT1, EXT2, EDBG I2C, LCD, Camera, and
Shield
PA04 TWICK0 SCL EXT1, EXT2, EDBG I2C, LCD, Camera, and,
Shield
------ -------- -------- ------------------------------------------
------ -------- --------
SAME70 SAME70 I2C
Pin Function Function
------ -------- --------
PA03 TWID0 SDA
PA04 TWICK0 SCL
------ -------- --------
I2C address:
@ -329,27 +343,26 @@ The configuration data device will appear at /dev/config.
Networking
==========
KSZ8061RNBVA Connections
KSZ8081RNACA Connections
------------------------
------ --------- --------- --------------------------
SAME70 SAME70 Ethernet Shared functionality
Pin Function Function
------ --------- --------- --------------------------
PD00 GTXCK REF_CLK Shield
PD01 GTXEN TXEN
PD02 GTX0 TXD0
PD03 GTX1 TXD1
PD04 GRXDV CRS_DV Trace
PD05 GRX0 RXD0 Trace
PD06 GRX1 RXD1 Trace
PD07 GRXER RXER Trace
PD08 GMDC MDC Trace
PD09 GMDIO MDIO
PA19 GPIO INTERRUPT EXT1, Shield
PA29 GPIO SIGDET
------ --------- ---------
SAME70 SAME70 Ethernet
Pin Function Functio
------ --------- ---------
PD0 GTXCK REF_CLK
PD1 GTXEN TXEN
PD2 GTX0 TXD0
PD3 GTX1 TXD1
PD4 GRXDV CRS_DV
PD5 GRX0 RXD0
PD6 GRX1 RXD1
PD7 GRXER RXER
PD8 GMDC MDC
PD9 GMDIO MDIO
PA14 GPIO INTERRUPT
PC10 GPIO RESET
------ --------- --------- --------------------------
------ --------- ---------
Selecting the GMAC peripheral
-----------------------------
@ -1127,9 +1140,9 @@ Configuration sub-directories
NOTES:
1. The serial console is configured by default for use with and Arduino
serial shield (UART3). You will need to reconfigure if you will
to use a different U[S]ART.
1. The serial console is configured by default for use with the EDBG VCOM
(USART1). You will need to reconfigure if you will to use a different
U[S]ART.
2. Default stack sizes are large and should really be tuned to reduce
the RAM footprint:

View File

@ -245,12 +245,12 @@ CONFIG_SAMV7_TWIHS0=y
# CONFIG_SAMV7_UART0 is not set
# CONFIG_SAMV7_UART1 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_USBDEVHS is not set
# CONFIG_SAMV7_USBHOSTHS 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_WDT0 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_UART1 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_UART5 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_SCI1 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_USART3 is not set
# CONFIG_ARCH_HAVE_USART4 is not set
@ -605,28 +605,30 @@ CONFIG_ARCH_HAVE_UART3=y
#
# USART Configuration
#
CONFIG_USART1_ISUART=y
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_SERIAL_DMA is not set
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_NO_SERIAL_CONSOLE is not set
#
# UART3 Configuration
# USART1 Configuration
#
CONFIG_UART3_RXBUFSIZE=256
CONFIG_UART3_TXBUFSIZE=256
CONFIG_UART3_BAUD=115200
CONFIG_UART3_BITS=8
CONFIG_UART3_PARITY=0
CONFIG_UART3_2STOP=0
# CONFIG_UART3_IFLOWCONTROL is not set
# CONFIG_UART3_OFLOWCONTROL is not set
# CONFIG_UART3_DMA is not set
CONFIG_USART1_RXBUFSIZE=256
CONFIG_USART1_TXBUFSIZE=256
CONFIG_USART1_BAUD=115200
CONFIG_USART1_BITS=8
CONFIG_USART1_PARITY=0
CONFIG_USART1_2STOP=0
# CONFIG_USART1_IFLOWCONTROL is not set
# CONFIG_USART1_OFLOWCONTROL is not set
# CONFIG_USART1_DMA is not set
# CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set

View File

@ -194,33 +194,30 @@
/* Ethernet MAC.
*
* KSZ8061RNBVA Connections
* KSZ8081RNACA Connections
* ------------------------
*
* ------ --------- --------- --------------------------
* SAME70 SAME70 Ethernet Shared functionality
* Pin Function Function
* ------ --------- --------- --------------------------
* PD00 GTXCK REF_CLK Shield
* PD01 GTXEN TXEN
* PD02 GTX0 TXD0
* PD03 GTX1 TXD1
* PD04 GRXDV CRS_DV Trace
* PD05 GRX0 RXD0 Trace
* PD06 GRX1 RXD1 Trace
* PD07 GRXER RXER Trace
* PD08 GMDC MDC Trace
* PD09 GMDIO MDIO
* PA19 GPIO INTERRUPT EXT1, Shield
* PA29 GPIO SIGDET
* ------ --------- ---------
* SAME70 SAME70 Ethernet
* Pin Function Functio
* ------ --------- ---------
* PD0 GTXCK REF_CLK
* PD1 GTXEN TXEN
* PD2 GTX0 TXD0
* PD3 GTX1 TXD1
* PD4 GRXDV CRS_DV
* PD5 GRX0 RXD0
* PD6 GRX1 RXD1
* PD7 GRXER RXER
* PD8 GMDC MDC
* PD9 GMDIO MDIO
* PA14 GPIO INTERRUPT
* PC10 GPIO RESET
* ------ --------- --------- --------------------------
* ------ --------- ---------
*/
#define GPIO_EMAC0_INT (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_FALLING | GPIO_PORT_PIOA | GPIO_PIN19)
#define GPIO_EMAC0_SIGDET (GPIO_INPUT | GPIO_CFG_DEFAULT | \
GPIO_PORT_PIOA | GPIO_PIN29)
GPIO_INT_FALLING | GPIO_PORT_PIOA | GPIO_PIN14)
#define GPIO_EMAC0_RESET (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOC | GPIO_PIN10)

View File

@ -70,6 +70,17 @@
# include "sam_progmem.h"
#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
# include <arch/board/boot_romfsimg.h>
#endif
@ -110,12 +121,66 @@ int sam_bringup(void)
#if defined(HAVE_S25FL1) || defined(HAVE_PROGMEM_CHARDEV)
FAR struct mtd_dev_s *mtd;
#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)
char blockdev[18];
char chardev[12];
#endif
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
/* Read the Ethernet MAC address from the AT24 FLASH and configure the
* Ethernet driver with that address.

View File

@ -68,6 +68,8 @@
#define HAVE_PROGMEM_CHARDEV 1
#define HAVE_WM8904 1
#define HAVE_AUDIO_NULL 1
#define HAVE_RTC_DSXXXX 1
#define HAVE_RTC_PCF85263 1
/* HSMCI */
/* Can't support MMC/SD if the card interface is not enabled */
@ -298,6 +300,48 @@
# 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 *************************************************/
/* Ethernet MAC.