SPI transmission and reception are not functioning as expected for stm32g0c1ret3 controller #86698
Labels
area: SPI
SPI bus
bug
The issue is a bug, or the PR is fixing a bug
platform: STM32
ST Micro STM32
priority: low
Low impact/importance bug
Describe the bug
The primary issue encountered is that SPI transmission and reception are not functioning as expected on stm32goc1ret3 board using zephyr 3.6.0 . Firstly, the SPI clock is not visible on the oscilloscope during transmission and reception. Despite the configuration being correctly set within the code, the expected waveforms for the SPI clock are not observable, indicating a potential issue with the signal generation or transmission. Secondly, the CS (Chip Select) pin is not setting and resetting as it should during SPI communication. Although the configuration for the CS pin is also correctly set in the code, the oscilloscope does not display the corresponding waveforms, suggesting that the pin is not being toggled as intended during data transfer.Additionally, the RX (Receive) buffer remains perpetually empty, and the RXNE (Receive Not Empty) flag is not being set for the G0 controller. This indicates that no data is being received, which further compounds the issue of SPI communication failure
Please also mention any information which could help others to understand
the problem you're facing:
What target platform are you using?
-->Zephyr 3.6.0 for STM32G0C1RET3 (SPI)
What have you tried to diagnose or workaround this issue?
-->CONFIGURATION MADE
//////////////// Overlay file ////////////////
/ {
aliases {
spi1 = &spi1;
gpiob = &gpiob;
};
};
&spi1 {
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
pinctrl-names = "default";
cs-gpios = <&gpiob 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
status = "okay";
};
////////////////Dts file /////////////////
&clk_lsi {
status = "okay";
};
&clk_hsi {
status = "okay";
};
&clk_hsi48 {
status = "okay";
crs-usb-sof;
};
&pll {
div-m = <1>;
mul-n = <8>;
div-p = <2>;
div-q = <2>;
div-r = <2>;
clocks = <&clk_hsi>;
status = "okay";
};
&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(64)>;
ahb-prescaler = <1>;
apb1-prescaler = <1>;
};
&spi2 {
pinctrl-0 = <&spi2_nss_pd0 &spi2_sck_pd1
&spi2_miso_pd3 &spi2_mosi_pd4>;
pinctrl-names = "default";
status = "okay";
};
Below are the action that we have performed and the observation that have been seen :-
• Action: Attempted to debug to verify if the values for the clock, baud rate, and CS pin were being set.
• Observation: The values are being set in the code.
• Action: Changed the baud rate from 1 MHz (desired for our microcontroller) to 8 MHz and 16 MHz to test functionality at higher frequencies.
• Observation: No effect was observed.
• Action: Attempted to observe the waveform of the CS pin when set in the code.
• Observation: No waveform was visible on the oscilloscope.
• Action: Attempted to observe the waveforms of the SPI clock and CS pin while the code was running.
• Observation: No waveforms were visible on the oscilloscope.
• Action: Manually set the CS pin to high or low.
• Observation: The CS pin was visible as high or low when set externally.
Zephyr 3.6.0:
• We checked the SPI clock on the Nucleo-G071RB and Nucleo-G474RE boards.
• On the Nucleo-G071RB, we were unable to observe the SCLK waveform.
• On the Nucleo-G474RE series, the SCLK waveform was observed and functioning correctly.
• The screenshot below is for the Nucleo-G474RE.
Zephyr 4.0.0:
• The attached zip file contains the code used to test the SPI example.
• The example code for SPI has been added to the \zephyr-v4.0.0\zephyr\samples\basic path.
• For the Nucleo-G071RB, we observed the same issue: there is no activity on the SCLK.
• For the Nucleo-G474RE, the SCLK waveform was observed and functioning correctly.
specific commit?
--> NA
To Reproduce
1. The pin configurations which was supported by our microcontroller has been done .Expected behavior
In SPI (Serial Peripheral Interface) communication, if values are transmitted via the transmission buffer, corresponding values should be received in the receiver buffer. This is a fundamental aspect of SPI's full-duplex communication capability.Impact
showstopperLogs and console output
**In Zephyr 3.6.0**we checked SPI clock on nucleo-g071rb and nucleo-g474re
In nucleo-g071rb we are not able to see sclk waveform and nucleo-g474re series its working fine
below screenshot is for nucleo-g474re
In Zephyr 4.0.0
we checked SPI clock on nucleo-g071rb and nucleo-g474re
In nucleo-g071rb we are not able to see sclk waveform and nucleo-g474re series its working fine
For nucleo-g071rb we observed same issue there is no activity on sclk
for nucleo-g474re sclk we are able to see the waveform
Environment (please complete the following information):
-->NA
Additional context
[](url) @AmolMeshram-eaton@bhardadinesh-eaton
@VividhaDhengre-eaton
The text was updated successfully, but these errors were encountered: