MTB CAT1 Peripheral driver library
SCB (Serial Communication Block)

General Description

The Serial Communications Block (SCB) supports three serial communication protocols: Serial Peripheral Interface (SPI), Universal Asynchronous Receiver Transmitter (UART), and Inter Integrated Circuit (I2C or IIC).

Only one of the protocols is supported by an SCB at any given time.

The functions and other declarations used in this driver are in cy_scb_spi.h, cy_scb_uart.h, cy_scb_ezi2c.h, cy_scb_i2c.h respectively. Include cy_pdl.h to get access to all functions and declarations in the PDL.

More Information

For more information on the SCB peripheral, refer to the technical reference manual (TRM).

Changelog

VersionChangesReason for Change
3.20 Added APIs Cy_SCB_UART_EnableSingleWireHalfDuplex, Cy_SCB_UART_DisableSingleWireHalfDuplex. UART half duplex mode implementation. Bug fixes.
Added API Cy_SCB_SPI_Transfer_Buffer and new macros. Added support for SPI transfer with different length and bug fixes for buffer transfer with different sizes.
3.10.1 Minor documentation updates. Documentation enhancement.
3.10 Fixed MISRA 2012 violations. MISRA 2012 compliance.
3.0 Updated Cy_SCB_SPI_Init and other internal data handling functions to handle wide range of data widths. Defect fixing.
Minor documentation updates. Documentation enhancement.
2.90 A new API, Cy_SCB_SetEzI2CMode, has been added to help set the hardware EZ mode for the I2C protocol. The HW EZ Mode for the I2C protocol can be enabled or disabled.
Newly added APIs Cy_SCB_I2C_SetStretchThreshold to set the stretch threshold value, Cy_SCB_I2C_GetStretchCount to get the stretch count, Cy_SCB_I2C_IsStretchDetected to detect if I2C SCL is stretched, Cy_SCB_I2C_IsSyncDetected to check if synchronization is detected on I2C SCL. Cy_SCB_I2C_IsStretching to check if DUT is stretching the I2C SCL. New device support.
2.80 Updated the behaviour of Cy_SCB_UART_SetEnableMsbFirst and Cy_SCB_UART_GetEnableMsbFirst functions. Now the value of enableMsbFirst is being set and fetched correctly. Defect fixing.
2.70 Newly added API's for runtime parameter set/get functionality which include Cy_SCB_UART_SetOverSample to set oversample bits of UART, Cy_SCB_UART_GetOverSample to add return value of oversample, Cy_SCB_UART_GetDataWidth to get data width, Cy_SCB_UART_SetDataWidth to set data width, Cy_SCB_UART_GetParity to get parity, Cy_SCB_UART_SetParity to set parity, Cy_SCB_UART_GetStopBits to get stop bits, Cy_SCB_UART_SetStopBits to set stop bits, Cy_SCB_UART_GetDropOnParityError to get drop on parity error, Cy_SCB_UART_SetDropOnParityError to set drop on parity error, Cy_SCB_UART_GetEnableMsbFirst to get enable MSB first and Cy_SCB_UART_SetEnableMsbFirst to set enable MSB first. Runtime Parameter update.
Newly added API's which include Cy_SCB_Get_RxDataWidth to return the RX data width, Cy_SCB_Get_TxDataWidth to return the TX data width, Cy_SCB_SetMemWidth to set the RX and TX FIFOs byte mode/halfword/word mode. Updated Structures cy_stc_scb_uart_config_t, cy_en_scb_spi_parity_t, cy_stc_scb_spi_config_t. New device support.
2.60 Fixed the Cy_SCB_UART_GetNumInRingBuffer function to return correct number of the elements in ring buffer. Cy_SCB_UART_GetNumInRingBuffer function works incorrectly, when write pointer of the ring buffer is behind the read pointer.
Fixed/Documented MISRA 2012 violations. MISRA 2012 compliance.
2.50 Fixed the Cy_SCB_SPI_SetActiveSlaveSelectPolarity function to properly configure the polarity of the slave select line. Cy_SCB_SPI_SetActiveSlaveSelectPolarity function works incorrectly.
2.40.2 Minor documentation updates. Documentation enhancement.
2.40 Update level selection logic of RX FIFO trigger in the Cy_SCB_UART_Receive(). Fix possible stuck if the RTS level is less than the RX FIFO level.
Exclude self-test assertion macros under release build profile. Avoid dependency on CY_ASSERT macro implementation.
2.30.1 Added header guards CY_IP_MXSCB. To enable the PDL compilation with wounded out IP blocks.
2.30 Fixed MISRA violation. MISRA compliance.
Changed values CY_SCB_SPI_CPHA0_CPOL1 and CY_SCB_SPI_CPHA1_CPOL0 in enum cy_en_scb_spi_sclk_mode_t. The incorrect values in cy_en_scb_spi_sclk_mode_t caused incorrect initialization of the combination of phases and polarity: "CHPA = 0, CPOL = 1" and "CHPA = 1, CPOL = 0".
Added new CY_SCB_UART_RECEIVE_NOT_EMTPY and CY_SCB_UART_TRANSMIT_EMTPY callback events UART Callback Events. Extended the driver callback events to support the MBED-OS.
Merged SCB changelogs for each mode into one changelog. Changelog optimization.
Merged SCB MISRA-C Compliance sections for each mode into one section. To optimize the SCB MISRA-C Compliance sections.
2.20.1 Documentation of the MISRA rule violation. MISRA compliance.
2.20 Flattened the organization of the driver source code into the single source directory and the single include directory. Driver library directory-structure simplification.
Added register access layer. Use register access macros instead of direct register access using dereferenced pointers. Makes register access device-independent, so that the PDL does not need to be recompiled for each supported part number.
Added the enableDigitalFilter, highPhaseDutyCycle and lowPhaseDutyCycle fields to the cy_stc_scb_i2c_config_t configuration structure. Added the I2C master data rate configuration using the configuration structure.
Fixed the Cy_SCB_I2C_SetDataRate function to properly configure data rates greater than 400 kbps in Master and Master-Slave modes.
Added verification that clk_scb is within the valid range for the desired data rate.
The analog filter was enabled for all data rates in Master and Master-Slave modes. This prevents reaching the maximum supported data rate of 1000 kbps which requires a digital filter.
2.10 Fixed the ReStart condition generation sequence for a write transaction in the Cy_SCB_I2C_MasterWrite function. The driver can notify about a zero length write transaction completion before the address byte is sent if the Cy_SCB_I2C_MasterWrite function execution was interrupted between setting the restart generation command and writing the address byte into the TX FIFO.
Added the slave- and master-specific interrupt functions: Cy_SCB_I2C_SlaveInterrupt and Cy_SCB_I2C_MasterInterrupt. Improved the interrupt configuration options for the I2C slave and master mode configurations.
Updated the Start condition generation sequence in the Cy_SCB_I2C_MasterWrite and Cy_SCB_I2C_MasterRead.
Updated the ReStart condition generation sequence for a write transaction in the Cy_SCB_I2C_MasterSendReStart function.
2.0 Added parameters validation for public API.
Fixed functions which return interrupt status to return only defined set of interrupt statuses.
Added missing "cy_cb_" to the callback function type names.
Replaced variables that have limited range of values with enumerated types.
Added function Cy_SCB_UART_SendBreakBlocking for break condition generation.
Fixed low power callbacks Cy_SCB_UART_DeepSleepCallback and Cy_SCB_UART_HibernateCallback to prevent the device from entering low power mode when RX FIFO is not empty. The callbacks allowed entering device into low power mode when RX FIFO had data.
Fixed SPI callback notification when error event occurred. The SPI callback passed incorrect event value if error event occurred.
Fixed the Cy_SCB_I2C_MasterSendReStart function to properly generate the ReStart condition when the previous transaction was a write. The master interpreted the address byte written into the TX FIFO as a data byte and continued a write transaction. The ReStart condition was generated after the master completed transferring the data byte. The SCL line was stretched by the master waiting for the address byte to be written into the TX FIFO after the ReStart condition generation. The following timeout detection released the bus from the master control.
Fixed the slave operation after the address byte was NACKed by the firmware. The observed slave operation failure depends on whether Level 2 assert is enabled or not. Enabled: the device stuck in the fault handler due to the assert assignment in the Cy_SCB_I2C_Interrupt. Disabled: the slave sets the transaction completion status and notifies on the transaction completion event after the address was NACKed. The failure is observed only when the slave is configured to accept an address in the RX FIFO.
1.0 Initial version.

API Reference

 Common
 Common API for the Serial Communication Block.
 
 EZI2C (SCB)
 Driver API for EZI2C Slave Peripheral.
 
 I2C (SCB)
 Driver API for I2C Bus Peripheral.
 
 SPI (SCB)
 Driver API for SPI Peripheral.
 
 UART (SCB)
 Driver API for UART.