This is similar to previous example but this time we perform the same operations in each eeprom one after the other memory, this is to demonstrate how one single sequence is necessary instead of duplicate sequences. Two jobs are attached to the only sequence we have but it is necessary two buffer, one for each job.

Mcu

Mcu:
  McuClockSettingConfig: "McuClockSettingConfig_0"
  ...
    McuPeripheralClockConfig: "McuPeripheralClockConfig_7"    # enable SPI clock with FIRC clock
      Peripheral Clock under MCU control: true
      Mcu Peripheral Name: LPSPI0
      Enable peripheral: true
      Peripheral clock selection: FIRC
      Peripheral Clock Frequency: 2.4E7
      ...

Port

Port:
  ...
  PortContainer: "PortContainer_0"
      General:
        PortNumberOfPortPins: 5
          PortPin: "EEPROM_MOSI"     # port as SPI MOSI
            PortPin Pcr: 36        
            PortPin Mode: LPSPI0_SOUT
            ...
          PortPin: "EEPROM_MISO"
            PortPin Pcr: 35        # port as SPI MISO
            PortPin Mode: LPSPI0_SIN
            ...
          PortPin: "EEPROM_CLK"
            PortPin Pcr: 34        # port as SPI Clock
            PortPin Mode: LPSPI0_SCK
            ...
          PortPin: "EEPROM_CS"
            PortPin Pcr: 37        # port as SPI Chip select
            PortPin Mode: LPSPI0_PCS0
            ...
          PortPin: "EEPROM_CS1"
            PortPin Pcr: 32    # port as scond SPI Chip select 
            PortPin Mode: LPSPI0_PCS1
            ...

Spi

Spi:
  General:
    Post Build Varian Used: true
    Config Variant: VarianPostBuild
    ...
    SpiGeneral:
      SpiDevErrorDetect: false
      SpiChannelBuffersAllowed: 1   # only use external buffer
      SpiLevelDelivered: 0
  SpiPhyUnit: "SpiPhyUnit_0"
    General:
      SpiPhyUnitMapping: LPSPI_0    # set the LPSPI module to use
      SpiPhyUnitMode: SPI_MASTER    # master mode
      SpiPhyUnitSync: true          # only synchronus comunication 
      SpiPinConfiguration: 0
      SpiPhyUnitClockRef: /Mcu/Mcu/McuModuleConfiguration/McuClockSettingConfig_0/McuClockReferencePoint_0
      ...
  SpiExternalDevice: "SpiExternalDevice_0"
    General:
      SpiBaudrate: 100000           # SPI configuration at 100KHz
      SpiCsIdentifier: PCS0         # Control pin CS 0
      SpiCsPolarity: LOW
      SpiCsSelection: CS_VIA_PERIPHERAL_ENGINE  # CS under peripheral control
      SpiDataShiftEdge: TRAILING      # sampling on falling edge
      SpiEnableCs: true
      SpiHwUnit: CSIB0
      SpiShiftClockIdleLevel: LOW     # clock idle in Low level
      ...
  SpiExternalDevice: "SpiExternalDevice_1"
    General:
      SpiBaudrate: 100000           # SPI configuration at 100KHz
      SpiCsIdentifier: PCS0         # Control pin CS 0
      SpiCsPolarity: LOW
      SpiCsSelection: CS_VIA_PERIPHERAL_ENGINE  # CS under peripheral control
      SpiDataShiftEdge: TRAILING      # sampling on falling edge
      SpiEnableCs: true
      SpiHwUnit: CSIB0
      SpiShiftClockIdleLevel: LOW     # clock idle in Low level
      ...
  SpiChannel: "SpiChannel_0"
    General:
      SpiChannelType: EB
      SpiDataWidth: 8
      SpiTransferStart: MSB
      ...
  SpiChannel: "SpiChannel_1"
    General:
      SpiChannelType: EB
      SpiDataWidth: 8
      SpiTransferStart: MSB
      ...
  SpiJob: "SpiJob_0"
    General:
      SpiDeviceAssignment: /Spi/Spi/SpiDriver/SpiExternalDevice_0
      ...
    SpiChannelList:
      SpiChannelAssignment: /Spi/Spi/SpiDriver/SpiChannel_0
      ...
  SpiJob: "SpiJob_1"
    General:
      SpiDeviceAssignment: /Spi/Spi/SpiDriver/SpiExternalDevice_1
      ...
    SpiChannelList:
      SpiChannelAssignment: /Spi/Spi/SpiDriver/SpiChannel_1
      ...
  SpiSequence: "SpiSequence_0"
    General:
      ...
    SpiJobAssignment:
      Index 0: /Spi/Spi/SpiDriver/SpiJob_0
      Index 0: /Spi/Spi/SpiDriver/SpiJob_1 

main.c

#include "Mcu.h"
#include "Port.h"
#include "Dio.h"
#include "Platform.h"
#include "Osif.h"
#include "Spi.h"
#include "SEGGER_RTT.h"

void EcuM_Init( void );

/*this is dummy delay function prepare just for this example, in a real application 
no delay shall be used*/
void Delay( uint32 ms )
{
    uint32 Timeout = OsIf_MicrosToTicks( ms * 1000u, OSIF_COUNTER_SYSTEM );
    uint32 SeedTick = OsIf_GetCounter( OSIF_COUNTER_SYSTEM );
    uint32 ElapsedTime = 0u;

    do
    {
        ElapsedTime += OsIf_GetElapsed( &SeedTick, OSIF_COUNTER_SYSTEM );
    }while( ElapsedTime < Timeout );
}

int main( void )
{
    Spi_DataBufferType TxBuffer1[4];
    Spi_DataBufferType TxBuffer2[4];
    Spi_DataBufferType RxBuffer1[4];
    Spi_DataBufferType RxBuffer2[4];

    EcuM_Init();
    SEGGER_RTT_Init();

    /*Enable writing instructions in the eeprom memories by sending a 0x06*/
    TxBuffer2[0] = TxBuffer1[0] = 0x06;          /*WREN Instruction value*/
    Spi_SetupEB( SpiConf_SpiChannel_SpiChannel_0, TxBuffer1, NULL, 1 );
    Spi_SetupEB( SpiConf_SpiChannel_SpiChannel_1, TxBuffer2, NULL, 1 );
    Spi_SyncTransmit( SpiConf_SpiSequence_SpiSequence_0 );
    
    /*Send to write the value 0x35 in the address 0 of the memory*/
    TxBuffer2[0] = TxBuffer1[0] = 0x02;                 /*Write instruction */
    TxBuffer2[1] = TxBuffer1[1] = 0x00;                 /*16 bit - address  */
    TxBuffer2[2] = TxBuffer1[2] = 0x00;                 /*16 bit - address  */
    TxBuffer1[3] = 0x38;                                /*Data byte         */
    TxBuffer2[3] = 0x39;                                /*Data byte         */
    Spi_SetupEB( SpiConf_SpiChannel_SpiChannel_0, TxBuffer1, NULL, 4 );
    Spi_SetupEB( SpiConf_SpiChannel_SpiChannel_1, TxBuffer2, NULL, 4 );
    Spi_SyncTransmit( SpiConf_SpiSequence_SpiSequence_0 );
    
    /*Wait for the data to be recorded in memory, it is not the best way to
    do it, so it's just for demonstration purposes*/
    Delay( 10 );

    /*Read a byte from direccion 0x00 of each eeprom memory, TransmitReceive() Function needs as parameters structure
    to handle SPI , buffer where data to transmit is stored, buffer where data received is stored, total amount
    of bytes to transmit and receive*/
    TxBuffer2[0] = TxBuffer1[0] = 0x03; 
    TxBuffer2[1] = TxBuffer1[1] = 0x00; 
    TxBuffer2[2] = TxBuffer1[2] = 0x00;
    Spi_SetupEB( SpiConf_SpiChannel_SpiChannel_0, TxBuffer1, RxBuffer1, 4 );
    Spi_SetupEB( SpiConf_SpiChannel_SpiChannel_1, TxBuffer2, RxBuffer2, 4 );
    Spi_SyncTransmit( SpiConf_SpiSequence_SpiSequence_0 );
    
    SEGGER_RTT_printf(0, "Data read from eeprom 1: %x\n", RxBuffer1[3] );
    SEGGER_RTT_printf(0, "Data read from eeprom 2: %x\n", RxBuffer2[3] );
    
    while( 1u )
    {
        Delay( 10u );
    }

    return 0u;
}

void EcuM_Init( void )
{
    Mcu_Init( &Mcu_Config );
    Mcu_InitClock( McuClockSettingConfig_0 );
    Mcu_SetMode( McuModeSettingConf_0 );
    /*Init the internal tick reference Systick Timer*/
    OsIf_Init( NULL_PTR );
    /*enable and setup interrupts*/
    Platform_Init( NULL_PTR );

     /*Apply all the Pin Port microcontroller configuration*/
    Port_Init( &Port_Config );

    /*init the LPSPI0 with the paramters set in Tresos*/
    Spi_Init( &Spi_Config );
}