XStore
View Categories

NORVI ARITA-STM32-M8 – USER GUIDE

7 min read

NORVI ARITA INDUSTRIAL APPLICATIONS #

Programming  #

NORVI-ARITA-STM32-M8 has a mini USB Port for serial connection with the SoC for programming. Any Arduino-supported programming IDE can be used to program the controller. Follow this Guide to programming NORVI Arduino-Based Controllers with Arduino IDE.

SoC:  Arduino Maple – STM32
Programming Port: USB UART

Digital Inputs #

Wiring Digital Inputs #

NORVI-ARITA-STM32-M8 Digital Input Wiring

The digital inputs of NORVI-ARITA-STM32-M8 can be configured as both a Sink and Source connection. The inverse of the Digital Input polar should be supplied to the common terminal.

Programming Digital Inputs #

Reading the relevant GPIO of AT-STM32 gives the value of the Digital Input. When the inputs are in the OFF state the GPIO goes HIGH, and when the input is in the ON stage GPIO goes LOW. Refer to the GPIO allocation table in the Datasheet for the digital input GPIO.

#define in1 PD0
#define in2 PA8
#define in3 PE4
#define in4 PE3
#define in5 PE2
#define in6 PE1
#define in7 PE0
#define in8 PB9
#define in9 PB8
#define in10 PB5
#define in11 PD7
#define in12 PD6
#define in13 PD5
#define in14 PD4

void setup() {
  pinMode(in1, OUTPUT); 
  pinMode(in2, OUTPUT); 
  pinMode(in3, OUTPUT); 
  pinMode(in4, OUTPUT); 
  pinMode(in5, OUTPUT);  
  pinMode(in6, OUTPUT); 
  pinMode(in7, OUTPUT); 
  pinMode(in8, OUTPUT); 
  pinMode(in9, OUTPUT); 
  pinMode(in10, OUTPUT); 
  pinMode(in11, OUTPUT); 
  pinMode(in12, OUTPUT);
  pinMode(in13, OUTPUT); 
  pinMode(in14, OUTPUT);
}
void loop() {
  digitalWrite(in1, LOW); 
  digitalWrite(in2, LOW); 
  digitalWrite(in3, LOW); 
  digitalWrite(in4, LOW); 
  digitalWrite(in5, LOW); 
  digitalWrite(in6, LOW); 
  digitalWrite(in7, LOW); 
  digitalWrite(in8, LOW);  
  digitalWrite(in9, LOW); 
  digitalWrite(in10, LOW);
  digitalWrite(in11, LOW);
  digitalWrite(in12, LOW);
  digitalWrite(in13, LOW);
  digitalWrite(in14, LOW);
}

RELAY AND TRANSISTOR OUTPUTS #

Wiring Relay and Transistor Outputs  #

NORVI-ARITA-STM32-M8 Relay and Transistor Output Wiring

 Programming Relay/ Transistor Outputs  #

Reading the relevant GPIO of AT-STM32 gives the value of the Relay/ Transistor Output.  Refer to the GPIO allocation table in the Datasheet for the Relay/ Transistor Output GPIO.

#define RO1 PC5
#define RO2 PB0
#define RO3 PB1
#define RO4 PE7
#define RO5 PE8
#define RO6 PE9
#define RO7 PE10
#define RO8 PE11
#define RO9 PA0
#define RO10 PA1
#define TR1 PA4
#define TR2 PC4
void setup() {
  pinMode(RO1, OUTPUT); 
  pinMode(RO2, OUTPUT); 
  pinMode(RO3, OUTPUT);  
  pinMode(RO4, OUTPUT); 
  pinMode(RO5, OUTPUT); 
  pinMode(RO6, OUTPUT); 
  pinMode(RO7, OUTPUT); 
  pinMode(RO8, OUTPUT); 
  pinMode(RO9, OUTPUT); 
  pinMode(RO10, OUTPUT); 
  pinMode(TR1, OUTPUT); 
  pinMode(TR2, OUTPUT);  
}
void loop() {
  digitalWrite(RO1, HIGH); 
  digitalWrite(RO2, HIGH); 
  digitalWrite(RO3, HIGH);
  digitalWrite(RO4, HIGH); 
  digitalWrite(RO5, HIGH); 
  digitalWrite(RO6, HIGH); 
  digitalWrite(RO7, HIGH); 
  digitalWrite(RO8, HIGH); 
  digitalWrite(RO9, HIGH);   
  digitalWrite(RO10, HIGH);
  digitalWrite(TR1, HIGH); 
  digitalWrite(TR2, HIGH);
  delay(500);

  digitalWrite(RO1, LOW);
  digitalWrite(RO2, LOW); 
  digitalWrite(RO3, LOW);
  digitalWrite(RO4, LOW); 
  digitalWrite(RO5, LOW);
  digitalWrite(RO6, LOW); 
  digitalWrite(RO7, LOW);
  digitalWrite(RO8, LOW);
  digitalWrite(RO9, LOW);
  digitalWrite(RO10, LOW);
  digitalWrite(TR1, LOW);
  digitalWrite(TR2, LOW);
}

ANALOG INPUT #

Wiring Analog Inputs #

NORVI-ARITA-STM32-M8 Analog Input Wiring

Reading Analog Input #

Reading the relevant I2C address of the ADC gives the value of the Analog Input.

0-10V Analog Inputs #

Reading the relevant I2C address of the ADC gives the value of the analog input.

4-20mA Analog Inputs #

Programming Analog Inputs  #

#include <Wire.h>
#define ADS1115_ADDRESS 0x48
int16_t ads1115(byte channel);
void setup() {
  Serial.begin(9600);
  Wire.begin();
}

void loop() {
  int16_t adcc0 = ads1115(0);int16_t adcc1 = ads1115(1);
  int16_t adcc2 = ads1115(2);int16_t adcc3 = ads1115(3);
  Serial.print("ADC0: ");
  Serial.println(adcc0);
  Serial.print("ADC1: ");
  Serial.println(adcc1);
  Serial.print("ADC2: ");
  Serial.println(adcc2);
  Serial.print("ADC3: ");
  Serial.println(adcc3);
  delay(5000);
}

int16_t ads1115(byte channel) {
  int16_t adcValue = 0;
  Wire.beginTransmission(ADS1115_ADDRESS);
  Wire.write(0x01); Wire.write(0xC3);
  Wire.endTransmission();
  delay(100);
  Wire.beginTransmission(ADS1115_ADDRESS);
  Wire.write(0x00); 
  Wire.endTransmission();
  Wire.requestFrom(ADS1115_ADDRESS, 2);
  if (Wire.available() == 2) {
    byte data1 = Wire.read();
    byte data2 = Wire.read();
    adcValue = (data1 << 8) | data2;
  }
  return adcValue;
}

RS-485 COMMUNICATION #

RS-485 Wiring #

DriverMAX485CSA
TXPA9
RX  PA10
Flow ControlPC9
GPIO Connections of RS-485

Programming RS-485 #

NORVI ARITA-STM32 series RS-485 connection uses a half-duplex mode of MAX485 transmitter with UART Communication.

#define RXD PA10
#define TXD PA9
#define FC PC9 

void setup() {
  Serial.begin(9600);
  pinMode(FC, OUTPUT); 
  Serial1.begin(9600, SERIAL_8N1,RXD,TXD); 
}

void loop() { 
  digitalWrite(FC, HIGH); // Make FLOW CONTROL pin HIGH
  Serial1.println("RS485 01 SUCCESS"); // Send RS485 SUCCESS serially
  delay(500); // Wait for transmission of data
  digitalWrite(FC, LOW); // Receiving mode ON 

  while (Serial1.available()) { // Check if data is available
    char c = Serial1.read(); // Read data from RS485
    Serial.write(c); // Print data on serial monitor
  }
  delay(1000);
}

Built-in OLED Display #

Display driverSSD1306
CommunicationI2C
Module Address0x3C
Resolution128 x 64
0.96 OLED Display Specification

Refer to the GPIO allocation table in the Datasheet for the I2C GPIO of the OLED Display.

Library supported by the Adafruit_SSD0306 Library.

Wire.begin (SDA, SCL) is required to initialize I2C on the correct pins.

Programming OLED Display #

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);    
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE); 
  display.setCursor(0, 1);
  display.print("ICONIC");
  display.setCursor(0, 25);
  display.setTextSize(1);
  display.println("NORVI CONTROLLER");
  display.println("K8");
  display.println("12 DI|1 PWM|4 AI|7 RL");
  display.println("ETHERNET | SD CARD");
  display.display();
  delay(5000);
  display.clearDisplay();
  display.setTextSize(0);
  Serial.print("Initializing SD card...");
  display.clearDisplay();
  display.setCursor(0, 0);
  display.print("Initializing SD card.");
  display.display();
  delay(2000);
}

void loop() {
  display1();
  delay(5000);
}

void display1() {
  display.clearDisplay();display.setCursor(0, 0);
  display.println("Test Analog Inp");
  display.println("");
  display.display();
}

Built-in Buttons #

Button 1 PinPC1
Button 2 PinPC0
Button 3 PinPE6
Button 4 PinPE5

Programming Buttons #

#define sw1 PC2
#define sw2 PC3
#define sw3 PC4
#define sw4 PC5
void check() {
  digitalWrite(RO1, !digitalRead(in1));
  digitalWrite(RO2, !digitalRead(in2));
  digitalWrite(RO3, !digitalRead(in3));
  digitalWrite(RO4, digitalRead(sw1));
  digitalWrite(RO5, digitalRead(sw2));
  digitalWrite(RO6, digitalRead(sw3));
  digitalWrite(RO7, digitalRead(sw4));
}

void setup()   
{                
   pinMode(sw1, INPUT);  
   pinMode(sw2, INPUT); 
   pinMode(sw3, INPUT); 
   pinMode(sw4, INPUT);
}

void loop() {
  delay(200);
}

Internal RTC #

RTC ChipDS1307ZN+
Backup Battery TypeCR2450N-IB
InterfaceI2C
I2C Address0x68
SCL PinPB6
SDA PinPB7

Programming RTC #

#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {
  Serial.begin(9600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
}

void loop () {
    DateTime now = rtc.now();
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");
    DateTime future (now + TimeSpan(7,12,30,6));
    Serial.print(" now + 7d + 12h + 30m + 6s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();
    Serial.println();
    delay(3000);
}

Micro SD Card Support #

Card TypemicroSD
InterfaceSPI
SD DetectPD9
SD CARD CSPD8
MISOPB13
MOSIPB14
SCLKPB15

Programming SD Card #

#include <SPI.h>
#include <SD.h>
#define chipSelect PD8
void setup() {
  Serial.begin(9600);
  Serial.print("Initializing SD card...");
  if (!SD.begin(chipSelect)) {
    Serial.println("SD Card failed, or not present");
    while (1);
  }
  Serial.println("SD card initialized.");
}

void loop() {
  saveSD();
  delay(5000);
}

void saveSD() {
  File dataFile = SD.open("datalog.txt", FILE_WRITE);
  if (dataFile) {
    dataFile.print("Hello, World!");
    dataFile.close();
    Serial.println("Data saved to datalog.txt on SD card");
  } 
  else {
    Serial.println("Error opening datalog.txt");
  }
}

ETHERNET SPI – W5500 #

TransceiverW5500
INTnPE14
SCSnPE13
RSTnPE15
MISOPB14
MOSIPB15
SCLKPB13

USB AND RESET #

USB port and Reset pin