Difference between revisions of "Smart IoT Sensor - HW"

From nemeuswiki
Jump to: navigation, search
(Created page with "Category:Smart IoT Sensor == Features == == Pictures == 500px 500px == Electrical Specification == == Included M...")
 
(GPIO available)
Line 245: Line 245:
 
|9
 
|9
 
|}
 
|}
 +
 +
=== Additional UARTs ===
 +
 +
 +
==== Remap PB10/PB11 as UART ====
 +
PB10/11 are dedicated to SPI connection to external devices.
 +
 +
If you don't need SPI, you can reuse these GPIOs as another UART
 +
 +
{| class="wikitable"
 +
!colspan="3"|Pinning relations
 +
|-
 +
|Physical pin
 +
|Port pin
 +
|Function pin on Arduino
 +
|-
 +
|23
 +
|PB10
 +
|MOSI / SERCOM4 TX
 +
|-
 +
|24
 +
|PB11
 +
|SCK / SERCOM4 RX
 +
|}
 +
 +
==== Remap PA22/PA23 as UART ====
 +
 +
PA22/PA23 are already used as I2C by 2 embedded sensors :
 +
* BMP280 (Temperature and pressure sensor)
 +
* ADXL345 (Accelerometer)
 +
 +
If you don't need them, you can reuse these GPIOs as another UART
 +
 +
{| class="wikitable"
 +
!colspan="3"|Pinning relations
 +
|-
 +
|Physical pin
 +
|Port pin
 +
|Function pin on Arduino
 +
|-
 +
|32
 +
|PA22
 +
|SDA / SERCOM3 TX
 +
|-
 +
|33
 +
|PA23
 +
|SCL / SERCOM3 RX
 +
|}
 +
 +
==== Example of scenario ====
 +
 +
This scenario sends "TEST" string to the UART and prints received data coming from the UART to the serial monitor.
 +
 +
To test this scenario, you can connect together the RX and TX pins of the corresponding UART, you will see the "TEST" string in the serial monitor.
 +
 +
It uses SPI GPIOs (MOSI/SCK). If you comment the first line (SERIAL_USE_SPI_PINS), it will use the I2C GPIOs (SDA/SCL).
 +
 +
 +
/* choose to remap SPI or I2C as UART */
 +
#define SERIAL_USE_SPI_PINS
 +
 +
#ifdef SERIAL_USE_SPI_PINS
 +
/*
 +
  * PB10 = MOSI = Serial3 TX = SERCOM4/PAD[2]
 +
  * PB11 = SCK  = Serial3 RX = SERCOM4/PAD[3]  */
 +
Uart Serial3( &sercom4, 24, 23, SERCOM_RX_PAD_3, UART_TX_PAD_2 ) ;
 +
#define UART_ISR SERCOM4_Handler
 +
 +
#else
 +
 +
/*
 +
  * PA22 = SDA = Serial3 TX = SERCOM3/PAD[0]
 +
  * PA23 = SCL = Serial3 RX = SERCOM3/PAD[1] */
 +
Uart Serial3( &sercom3, 33, 32, SERCOM_RX_PAD_1, UART_TX_PAD_0 ) ;
 +
#define UART_ISR SERCOM3_Handler
 +
 +
#endif
 +
 +
void UART_ISR()
 +
{
 +
  Serial3.IrqHandler();
 +
}
 +
 +
void setup() {
 +
  SerialUSB.begin(115200);
 +
  while(!SerialUSB){;;}
 +
 +
  SerialUSB.println("Start");
 +
 +
  Serial3.begin(115200);
 +
  while(!Serial3){;;}
 +
}
 +
 +
void loop()
 +
{
 +
  /* Send string to UART */
 +
  Serial3.println("TEST");
 +
  delay(1000);
 +
 +
  while(Serial3.available())
 +
  {
 +
    /* echo received data to the serial monitor */
 +
    SerialUSB.print((char)Serial3.read());   
 +
  }
 +
}
  
 
== Buttons and LEDs ==
 
== Buttons and LEDs ==

Revision as of 15:44, 9 March 2017

1 Features

2 Pictures

500px

500px

3 Electrical Specification

4 Included Modules and chipsets

4.1 LoRa/Sigfox MM002

NEMEUS: MM002 datasheet

The Nemeus MM002 is wired using UART and a wakeup pin.

Pinning relations
Physical pin Port pin Function pin on sensor Function pin on Arduino Atmel label
28 PA19 TX RX (Serial2) SERCOM1/PAD[3]
27 PA18 RX TX (Serial2) SERCOM1/PAD[2]
9 PA04 WakeUp A3

4.2 Bluetooth Smart nRF51822

Nordic Semi: nRF51822 datasheet

the nRF51822 is wired to an Arduino UART port. (Variant AC : 256KB Flash / 32KB Ram)


Pinning relations
Physical pin (SAMD) Physical pin (nRF51) Port pin (SAMD) Port pin (nRF51) Function pin on sensor Function pin on Arduino Atmel label
31 17 PB23 P0.11 TX RX (Serial) SERCOM5/PAD[3]
30 15 PB22 P0.09 RX TX (Serial) SERCOM5/PAD[2]

4.3 GPS/GNSS SIM33ELA

SIMCom: SIM33ELA datasheet

The SIM33 GPS is wired using UART to the Arduino.

Pinning relations
Physical pin Port pin Function pin on sensor Function pin on Arduino Atmel label
15 PA10 RX TX (Serial1) SERCOM0/PAD[2]
16 PA11 TX RX (Serial1) SERCOM0/PAD[3]
3 PA02 Power enable A0
29 PA20 Fix GPS 6

5 Included Sensors

5.1 ADXL345

The ADXL345 accelerometer is wired to the I2C bus, and can use two interrupts to manage acceleration events (tap, activity...).

Pinning relations
Physical pin Port pin Function pin on sensor Function pin on Arduino
31 PA22 SDA SDA
32 PA23 SCL SCL
7 PB08 Interrupt 1 A1
8 PB09 Interrupt 2 A2


5.2 BMP280

The BMP280 temperature and pressure sensor is wired on I2C bus.

Pinning relations
Physical pin Port pin Function pin on sensor Function pin on Arduino
31 PA22 SDA SDA
32 PA23 SCL SCL

6 GPIO available

You can use these additional pins :

Pinning relations
Physical pin Port pin Function pin on Arduino
x GND x
47 PB02 A5
10 PA05 A4
9 PA04 A3
x 3V3 x
21 PA12 MISO
20 PB11 SCK
19 PB10 MOSI
4 PA03 AREF
31 PA22 SDA (shared with sensors)
32 PA23 SCL (shared with sensors)
26 PA17 13
30 PA21 7
11 PA06 8
12 PA07 9

6.1 Additional UARTs

6.1.1 Remap PB10/PB11 as UART

PB10/11 are dedicated to SPI connection to external devices.

If you don't need SPI, you can reuse these GPIOs as another UART

Pinning relations
Physical pin Port pin Function pin on Arduino
23 PB10 MOSI / SERCOM4 TX
24 PB11 SCK / SERCOM4 RX

6.1.2 Remap PA22/PA23 as UART

PA22/PA23 are already used as I2C by 2 embedded sensors :

  • BMP280 (Temperature and pressure sensor)
  • ADXL345 (Accelerometer)

If you don't need them, you can reuse these GPIOs as another UART

Pinning relations
Physical pin Port pin Function pin on Arduino
32 PA22 SDA / SERCOM3 TX
33 PA23 SCL / SERCOM3 RX

6.1.3 Example of scenario

This scenario sends "TEST" string to the UART and prints received data coming from the UART to the serial monitor.

To test this scenario, you can connect together the RX and TX pins of the corresponding UART, you will see the "TEST" string in the serial monitor.

It uses SPI GPIOs (MOSI/SCK). If you comment the first line (SERIAL_USE_SPI_PINS), it will use the I2C GPIOs (SDA/SCL).


/* choose to remap SPI or I2C as UART */
#define SERIAL_USE_SPI_PINS

#ifdef SERIAL_USE_SPI_PINS
/* 
 * PB10 = MOSI = Serial3 TX = SERCOM4/PAD[2]
 * PB11 = SCK  = Serial3 RX = SERCOM4/PAD[3]  */
Uart Serial3( &sercom4, 24, 23, SERCOM_RX_PAD_3, UART_TX_PAD_2 ) ;
#define UART_ISR SERCOM4_Handler

#else

/* 
 * PA22 = SDA = Serial3 TX = SERCOM3/PAD[0]
 * PA23 = SCL = Serial3 RX = SERCOM3/PAD[1] */
Uart Serial3( &sercom3, 33, 32, SERCOM_RX_PAD_1, UART_TX_PAD_0 ) ;
#define UART_ISR SERCOM3_Handler

#endif

void UART_ISR()
{
  Serial3.IrqHandler();
}

void setup() {
  SerialUSB.begin(115200);
  while(!SerialUSB){;;}

  SerialUSB.println("Start");

  Serial3.begin(115200);
  while(!Serial3){;;}
}

void loop() 
{
  /* Send string to UART */
  Serial3.println("TEST");
  delay(1000);

  while(Serial3.available())
  {
    /* echo received data to the serial monitor */
    SerialUSB.print((char)Serial3.read());    
  }
}

7 Buttons and LEDs

7.1 Reset Button

A reset button est available on board: pushing the reset button will only reset the SAMD21. In others words, the Arduino bootloader will restart and jump to the user's application.

If the reset is pushed twice, the MCU will remain in bootloader mode, allowing USB emulation and serial communication.

7.2 User Button

The user button is connected in pull down to the MCU.

Pinning relations
Physical pin Port pin Function pin on sensor Function pin on Arduino
25 PA16 USER button 11


7.3 LED

The RGB leds are wired on simple GPIOS.

Pinning relations
Physical pin Port pin Function pin on sensor Function pin on Arduino
23 PA14 BLUE 2
14 PA09 GREEN 3
24 PA15 RED 5

8 Battery

An optional battery can be added inside the case. A 2 pins connector is available on board, leading to a power and charging management IC for the entire board. The Smart IoT Sensor can work by itself without any external connection.

If an USB connection is made, the USB's power will be drained to the battery by the charging IC. While the board is connected, it will use the USB power supply first.

9 Case

The Smart IoT Sensor features a 50*50*25mm case. All the hardware is all-included inside the case. There is no visible outside antenna.

The case has one miniUSB connector for USB communication on one side, and works as power supply as well.

The user LED is visible on the top of the case.

10 Antennas

10.1 Bluetooth Smart antenna

The board embeds an RF Ceramic Antenna.

10.2 GPS/GNSS (SIM33ELA) antenna

The antenna is integrated on the module.

10.3 LoRa/Sigfox (MM002) antenna

We provide a finely tuned PCB antenna onboard.

There is also an UFL connector in case you need an external antenna.

11 SWD Debug Port

The SWD 9 pins connector onboard can be used with your SWD debugger.

We suggest you to use a J-Link 9-pin Cortex-M Adapter with the J-Link BASE SWD debug probe

The SWD switch allows you to choose the SAMD21 or the BLE as SWD target for the debug probe.

11.1 SWD connection to the SAMD21

You received your board with a preloaded firmware in the SAMD chipset. If you bricked your board, this procedure can be used to re-flash the arduino firmware.

Set the SWD switch to MCU position. launch JLinkGDBServer:

/opt/SEGGER/JLink/JLinkGDBServer -if SWD -device ATSAMD21G18 -speed 4000

You should see "Listening on TCP/IP port 2331"

From gdb, connect to the gdbserver:

arm-none-eabi-gdb
(gdb) target remote localhost:2331
(gdb) restore bootloader.hex

11.2 SWD connection to the nRF51822

You received your board with a preloaded firmware in the BLE chipset. This firmware is a basic UART to BLE demonstration software.

We describe this procedure in case you need to re-flash the bluetooth firmware to match your specific needs.

Set the SWD switch to BLE position.

The full support can be found from [Nordic https://devzone.nordicsemi.com/tutorials/7/] Here is an abstract for the UART BLE example:

Install GNU Make

sudo apt-get install build-essential checkinstall

Download Nrf51 SDK 11.0.0.

Download nRF5x Command Line Tools.

Set the toolchain path in makefile.windows or makefile.posix depending on platform you are using:

<SDK>/components/toolchain/gcc/Makefile.[platform]

You have to choose the correct LD script for the nRF81822. Please use pca10028 for 256kB of flash and 32KB of ram. Update this file:

<SDK>/examples/bsp/pca10028.h
 #define RX_PIN_NUMBER  9
 #define TX_PIN_NUMBER  11
 #define HWFC           false

We need to update the main file in uart_init() function :

<SDK>/examples/ble_peripheral/ble_app_uart/main.c
 APP_UART_FLOW_CONTROL_DISABLED
 UART_BAUDRATE_BAUDRATE_Baud9600

Now, we can build it, go to:

<SDK>/examples/ble_peripheral/ble_app_uart/pca10028/s130/armgcc

build and flash the BLE chip:

make
make flash_softdevice
make flash

12 Certification