Introduction

OSS-ECAL (called ˈiː kæl) is an abbreviation for Open Source Software for Electronic Components Abstraction Layer.

OSS-ECAL Introduction

Background

Software for electronic components does not need to be newly developed for each electronic product because the functions of electronic components are pre-specified. In addition, software for electronic components is a non-competitive area that does not create a competitive advantage in electronic products, making it an unnecessary development cost. For this reason, product manufacturers are increasingly asking electronic component manufacturers to provide software for electronic components.

Purpose

The purpose of OSS-ECAL is to reduce development costs and improve quality for product manufacturers and electronic component manufacturers by promoting the common use of software for electronic components, a non-competitive area.

Features

OSS-ECAL is software with the following features.

 1. Standard interfaces (APIs) for electronic components as software.

 2. Interfaces (APIs) tailored to the characteristics of each electronic component.

 3. Supports combinations of electronic components.

 4. Wrapping each HAL.

 5. Compatible with HAL from various MCU manufacturers.

Programming language: C programming language. In addition, the extension of OSS-ECAL for Mbed and Arduino has been changed to .cpp to match C++ programming language.

Definition of Terms

The definitions of terms and coding designations used in this document are shown in the table below.

TermDefinition
ABCModel number of electronic component temporary name
APIApplication interface
c(prefix)Const constant label name prefix
COMMANDCommand temporary name
e(prefix)Enumerated type member-name prefix
et(prefix)Enumerated type tag-name prefix
etCMPOSS-ECAL common component code enum definition
etSTSOSS-ECAL common status code enum definition
gv(prefix)Global variables label name prefix
HALHardware Abstraction Layer
In AUTOSAR, MCAL
HALNAMEHAL temporary name
Refer to the HAL correspondence table for HALNAME.
i(prefix)Immediate constant label name prefix
o(prefix)Command API function name prefix
OSS-ECALOpen Source Software for Electronic Components Abstraction Layer
st(prefix)Struct type label name prefix
sv(prefix)Static variable label name prefix
tbl(prefix)Table constants label name prefix
ComponentElectronic component
SW ComponentSoftware component

API Function

Basic API Structure

The API is a command API function by electronic component model number and command as follows.

etSTS oABC_COMMAND( stABC_I, stABC_O* )

Function nameoABC_COMMANDAPI function name of ABC
Return valueetSTSOSS-ECAL status code
Parameter INstABC_IInput data of ABC function
Parameter OUTstABC_O*Output data of ABC function

Command API Function Examples

The Byte Write command API function of Microchip Technology’s EEPROM 24xx256 series is introduced as an example.

etSTS o24xx256_BYTE_WRITE( etCMP cmp, uint16 mem_adr, uint8 val )

Process Overview:
The o24xx256_BYTE_WRITE function is an API function that writes the value of val to the specified address mem_adr for the 24xx256 series (24AA256, 24LC256, 24FC256). This function returns the return value eSTS_EXE until the time (i24xx256_WRITE_TIME [ms]) to complete writing has elapsed.

Return valueetSTSOSS-ECALステータスコード
 eSTS_FIN
 eSTS_EXE
 eSTS_ERR_PARAMETER
 eSTS_ERR_I2C_OBJECT
 eSTS_ERR_OTHERS_RUN
 eSTS_ERR_HAL_OTHERS_RUN
 eSTS_ERR_HAL_I2C

Completed successfully
During execution
parameter error(out of memory address range)
I2C object selection error
Other components are executing the process
Other applications are running HAL
HAL I2C error
Parameter INetCMP cmpCommon component codee24xx256 20007U
uint16 mem_adrMemory addressRange 0x0000 to 0x7fff
uint8 valData to be writtenRange 0x00 to 0xff

Note:
The i24xx256_WRITE_TIME [ms] elapsed measurement is calculated from the Thread period that calls this function, so set the Thread period to THREAD_OSS_ECAL_PERIOD [ms]. When using this function, please use the o24xx256_WP_DIS function to release write-protection before using this function.

Reference:
The 24xx256 series also provides the following other command API functions.

etSTS o24xx256_PAGE_WRITE( etCMP cmp, uint16 mem_adr, uint16 len, uint8* buf )
The o24xx256_PAGE_WRITE function is an API function that writes the values buf[0] through buf[len-1] for the 24xx256 series (24AA256, 24LC256, 24FC256) in order from the specified address mem_adr. This function returns the return value eSTS_EXE until the time to complete the write (i24xx256_WRITE_TIME [ms]) has elapsed.

etSTS o24xx256_CURRENT_READ( etCMP cmp, uint8* rlt )
The o24xx256_CURRENT_READ function is an API function that reads the value of 1 byte from the last Read or Write address + 1 for the 24xx256 series (24AA256, 24LC256, 24FC256) and stores it in rlt.

etSTS o24xx256_RANDOM_READ( etCMP cmp, uint16 mem_adr, uint8* rlt )
The o24xx256_RANDOM_READ function is an API function that reads a 1-byte value from a specified address mem_adr for the 24xx256 series (24AA256, 24LC256, 24FC256) and stores it in rlt.

etSTS o24xx256_SEQ_READ( etCMP cmp, uint16 mem_adr, uint16 len, uint8* buf )
The o24xx256_SEQ_READ function is an API function that reads data for len from the specified address mem_adr for the 24xx256 series (24AA256, 24LC256, 24FC256) in sequence and stores the data from buf[0] to buf[len-1].

etSTS oAT24C08C_WP_EN( etCMP cmp )
The o24xx256_WP_EN function is an API function that outputs Write protect enable (write disable) = “Hi” for the 24xx256 series (24AA256, 24LC256, 24FC256).

etSTS oAT24C08C_WP_DIS( etCMP cmp )
The o24xx256_WP_DIS function is an API function that outputs Write protect disable (write enable) = “Low” for the 24xx256 series (24AA256, 24LC256, 24FC256).

HAL Support

OSS-ECAL’s HAL support is as follows (expanding sequentially). Please check each electronic component’s OSS-ECAL page for HAL support. Please note that even the same HAL may not work with different versions, MCUs, or development environments.

ManufacturerSDK/IDE ToolHAL NameVerSupport
ArduinoArduino IDEArduino1.8.6X
ArmKeil MDK v6Mbed OS6.17.0X
DebianGNU/Linux10.3
InfineonModusToolboxmtb-hal-cat12.4.3X
NXPMCUXpresso SDKSDK_2.x_EVKB-IMXRT10502.16X
STMicroelectronicsPlatformSDK_S32K1_2022_02AUTOSAR MCAL4.4
RenesasSynergy Software PackageHAL2.6.0
STMicroelectronicsSTM32CubeSTM32CubeF4V1.28.1X
Development environment

The MCU and development environment during development are as follows.

HAL NameManufacturerBoardMCUIDE
ARDUINOArduino1.Mega 2560 Rev3
2.Arduino Pro Mini 3.3V
ATmega2560
ATmega328P
Arduino IDE 2.3.3
MBEDSTMicroelectronicsSTM32 Nucleo-64 boardsSTM32F401RETxArm Keil Studio Cloud
LinuxBeagleBoardBeagleBone BlackTI AM335x
ModusToolboxInfineonCY8CPROTO-063-BLE PSoC 6 BLE Prototyping KitCYBLE-416045-02ModusToolbox
iMXRT1051B1052BNXPIMXRT1050-EVKBi.MX RT1050MCUXpresso IDE
MCALSTMicroelectronicsS32K144EVB-Q100S32K144S32 Design Studio for S32 Platform
SSPRenesasS7G2 SKR7FS7G27H3A01CFCe² studio for Renesas Synergy
STM32F4STMicroelectronicsSTM32 Nucleo-64 boardsSTM32F401RETxSTM32CubeIDE

File configuration

Please refer to the following example for the file structure of OSS-ECAL. The file structure differs depending on the HAL, so please check the OSS-ECAL page for each component.

Example: 24xx256 Folder structure

FolderFileSummary
24xx256_IMXRT1050_010000/samplesample.cSample application program
sample.hSample application header
24xx256_IMXRT1050_010000o24xx256.cOSS-ECAL program for 24xx256
o24xx256.hOSS-ECAL header for 24xx256
oss_ecal.hOSS-ECAL common header
user_setting.cUser configured constants and tables
user_setting.hUser configuration Header
readme.mdReadme
OSS-ECAL Terms of Use.txtOSS-ECAL Terms of Use

Built-in method

To incorporate command API functions into your product program, follow these steps.

  1. Obtaining the OSS-ECAL file
  2. Configure MCU and product program information
  3. Add command API functions to product program
  4. OSS-ECAL file added to product program development environment
1. Obtaining the OSS-ECAL file

Please inquire about downloading from the component page of the English OSS-ECAL site (https://oss-ecal.com/). The OSS-ECAL file (zip format) will be sent as an e-mail attachment to the e-mail address you specify.

Please unzip the sent file and remove the sample folder from the HAL folder to be used. Please use the files in the sample folder as reference code for incorporating into your application.

2. Configure MCU and product program information

This section explains how to embed OSS-ECAL based on the example of connecting one EEPROM 24xx256 series to an MCU (NXP i.MX RT1050). Match the code section in blue to the MCU or product program.

The MCU settings shown below are label names and circuit settings configured in the NXP MCUXpresso SDK.

1 Set the command API function cycle

Set the call cycle of the command API function in user_setting.h.
In this example, the cycle is 50ms.

<pre class="nohighlight">
// Immediate definitions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define THREAD_OSS_ECAL_PERIOD  50U     // Thread period time[ms]
2 Device address setting

The pin levels of A0, A1, and A2 pins of the 24xx256 series should be set in user_setting.h as shown in the following code.
In this example, A0 pin=Low(b0=0), A1 pin=Low(b1=0), A2 pin=Low(b2=0).

// Device address Code bit2:A2, bit1:A1, bit0:A0
#define M24xx256              0b00000000
// I2C components address
#define I2C_ADR_24xx256       (( 0b00001010 << 3 ) | ( 0x07 & M24xx256 ))
3 Set the number of send/receive buffers

The number of send/receive buffers should be set in user_setting.h as shown in the code below. 24xx256 series has a maximum of 64Byte send/receive buffers.
In this example, the number of send buffers is 64Byte and the number of receive buffers is 64Byte.

// TX and RX buffer size(bytes) for 24xx256
// CAUTION : Set the minimum value among the following
// - Number of send/receive buffers used by the application
// - Number of send/receive buffers used by HAL
// - Number of 24xx256 send/receive Max 64 bytes
#define TX_N_24xx256            64U
#define RX_N_24xx256            64U
4 MCU pin setting for write protect

The MCU GPIO pins connected to the write protect pin of the 24xx256 series should be set in user_setting.h as shown in the following code.
In this example, the write protect pin is connected to BOARD_INITPINS_M24xx256_WP_PIN on BOARD_INITPINS_M24xx256_WP_PORT.

// OSS-ECAL GPIO hard wiring
#define CMP_GPIO_NUM       1U      // OSS-ECAL GPIO components number
#define GPIO_24xx256_WP    BOARD_INITPINS_M24xx256_WP_PORT
#define PIN_24xx256_WP     BOARD_INITPINS_M24xx256_WP_PIN
5 I2C communication settings

The I2C to communicate with the 24xx256 series should be set in user_setting.h as shown in the following code.
In this example, the I2C communication LPI2C1_PERIPHERAL is connected, and the baud rate is set to 400 kHz.
In addition, one component using OSS-ECAL for I2C communication is assumed.

// OSS-ECAL I2C components hard wiring
#define CMP_I2C_NUM             1U
#define I2C_HZ                  400000              // MCU I2C frequency
#define I2C_24xx256             LPI2C1_PERIPHERAL // LPI2C peripheral base address
6 Set the number of I2C communication retries

The number of I2C communication retries should be set in user_setting.h as shown in the following code.
In this example, the I2C communication error is set to retry three times.

// I2C settings
#define I2C_RETRY               3U      // Retry times
7 Table setting for Device address and I2C

Set the device address set in 2 and the I2C set in 5 in user_setting.c as shown in the code below.

// HAL I2C object table for components
const stI2C_MCUX_OBJ tblI2C[ CMP_I2C_NUM ] =
{
        { e24xx256, I2C_ADR_24xx256, I2C_24xx256 }
};
8 Table setting of MCU pin for Write protect

Set the GPIO of write-protect set in 4 in user_setting.c as shown in the following code.

// HAL GPIO object table for components
const stGPIO_MCUX_OBJ tblGPIO[ CMP_GPIO_NUM ] =
{
        { e24xx256, GPIO_24xx256_WP, PIN_24xx256_WP }
};
3. Add command API functions to product program

Refer to sample.c to add command API functions to your product program.

4. OSS-ECAL file added to product program development environment

Please add the OSS-ECAL file addition to your product program development environment.

5. Other ways to incorporate

How to incorporate multiple OSS-ECALs in a user program (same MCU function)

How to incorporate multiple OSS-ECALs in a user program (different MCU function)

How to incorporate multiple identical electronic components into a user program

How to reduce the impact on user programs by replacing electronic components

Points to note

Please use the OSS-ECAL in compliance with the OSS-ECAL Terms of Use. In addition, verification of electronic products is the responsibility of the product manufacturer.

OSS-ECAL English
error: Content is protected !!