By default, the slew rate for SPI pins is set to ‘Fast’. When the slew rate is fast, there are chances that the signal might overshoot or undershoot.
To avoid this situation, the slew rate of the signals can be set to slow.
Note: When set to slow, the rise and fall times of the signal will reduce; you must ensure that these are within limits as mentioned by the specifcation in the datasheet.
To change the slew rate, modify the PORT_SLOW bit of the GPIO_PRTx_PC register the SPI pins have been assigned to. By default, this bit is cleared, that is, the slew rate is set to ‘Fast’. Set this bit to change the slew rate to ‘slow’.
For more details on this please refer to the 4100 S Plus Register TRM.
If the SPI pins are assigned to Port 1 of the device, set the PORT_SLOW bit (26th bit) of the register using the following macro:
CY_SET_REG32((void *)(CYREG_GPIO_PRT1_PC), 0x0200018Eu);
Note: The default value of the register is 0x0000018Eu; setting the PORT_SLOW bit (26th bit) of the register makes the value to be 0x0200018Eu.
If the slew rate is set to fast for a low-frequency signal (44 kHz in the figure shown below), the output may have an overshoot/undershoot as shown below in Figure 1:
Figure 1: Output signal when slew rate is set to fast at a frequency of 44 kHz
When the slew rate is changed to slow, the overshoot/undershoot reduces as shown in Figure 2:
Figure 2: Output signal when the slew rate is set to slow at a frequency of 44 kHz
Another way to change the slew rate is as follows:
1. Check the Show SPI terminals box under the SPI Pins tab in the SPI Component configuration window.
Figure 3: Check the Show SPI Terminal check box
2. Connect digital output pins to the visible terminals of the SPI Component
3. Change the slew rate to Slow in the Pin Component configuration window of the pins that will be connected to the terminals of the SPI Component.
Figure 4: Changing slew rate of the pins connected to the SPI Component