My setup is the following: a Nucleo board (Nucleo 144 embedding a STM32H743) is configured as SPI Master. Another identical board is configured as SPI Slave.
For the Master I setup the SPI1 (pins GND, D11, D12 and D13 - PA5,6,7- of the CN7 connector) with following config:
GPIO: very high speed, alternate function 5
SPI: prescaler DIV8, interrupts enabled, simplex communication, no Slave Select
all clocks set to maximum (CPU 400MHz, etc...)
For the Slave I setup the SPI1 too (same pins), it works fine.
Then I tried to switch to SPI2 peripheral for the Slave board and could not make it work (no change to master board).
I chose the pins D18 (PB13) for SCK, A7 (PC2) for MISO and A2 (PC3) for MOSI.
I've checked the following points:
SPI2 periph clock is enabled
GPIOB and C clocks are enabled and pins PB13, PC2 and PC3 are set up the same way as PA5,6,7 in previous setup.
for the GND I tried different GND pins on the board, I don't know if it makes a difference.
the GPIOs used for SPI2 are not used elsewhere in my code. I've got them from the datasheet of STM32H743ZI
What I see:
my slave is still receiving the SCK signal correctly: I get the correct number of RXP interrupts.
the data received by the slave is corrupted.
however the data send by the slave to the master is correct.
I think the MOSI signal is badly configured, either physically or logically. I tried the other GPIO pins whose alternate function can be SPI2_MOSI but same behaviour.
Is there a specificity to SPI2 and/or this GPIO setup ? Does the GND location on the board matter ?
I "fixed" (?) the issue by setting a pull-down to the SPI2 input GPIO on Slave side. I don't really understand why it was working without pull-down on SPI1 neither why this pull down is needed on a Slave ?
Related
We are using STM32CubeMX to generate the initial code for ADC pin-matching.
In our particular case, all of the 16 available pins- that is, PA0 to PA7, PB0 to PB1, and PC0 to PC5- in the ADC1 mode are used. It is interesting yet absurd to find that while all the other pins generate the normal voltage values(varing from 1500 to 3000), PB0 outputs 0 constantly and PB1 outputs 4040 averagely.
We have examined multiple times and we are pretty sure the problem isn't on our external sensor. Meanwhile, we have used a second board(identical model number), however, the same issue reoccurred. We exerted ourselves to fix the problem yet still trapped by it.
CubeMX initialization pic1
CubeMX initialization pic2
I have a board using STM32F405RG, my client designed the hardware and had to use a couple of the JTAG pins (PA15 and PB4) as GPIO. I use SWD for flashing and debug so I would like to disable the JTAG interface and, as stated in the ST docs, "release" PA15 and PB4 to be used as GPIO outputs.
Most of my searches return how to disable the JTAG interface refer to the STM32F1xx and the F4 is much different in this area.
Since with PA15 and PB4 the AFR setting of zero selects the JTAG pin functions how does one release them to be used as GPIO outputs?
It's true that F1 JTAG port settings are different from F4 series.
In F1 series, you need to disable them from AF remap and debug I/O configuration register. For example, the following code disables JTAG pins but leaves SWD enabled:
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN; // Enable A.F. clock
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; // JTAG is disabled, SWD is enabled
In F4 series it's easier. It's true that AF 0 selects JTAG pins but all you have to do is not selecting AF in MODER registers. On power-up, PA13, PA14, PA15, PB3 & PB4 are set to alternate function mode by their corresponding MODER bits. Just select another mode (input, output or analog) for those pins using the MODER registers.
You have to as you said "release" PA15 and PB4 to be used as GPIO outputs.
I don't think the F1 and F4 are different in this matter. So you configure them as outputs and set them forced high or low. This will disable their ability to be driven by the JTAG adapter
I am a newbie to STM32 and CubeMX. I need to create 3 UART interface and 2 I2C interface in STM32F103C8T6. I tried to, but there is a common port for both i2c and uart communication and it allows me to create only (2 uart and 2 i2c) or (3 uart and 1 i2c ) and I couldn't create as I needed . how can I establish 3 UART and 2 I2C interface at a same time in STM32F103C8T6 ?
Thanks in advance...
You can't. There's an unresolvable pin conflict.
The I2C2 peripheral must use pins PB10 and PB11 for SDA and SCL -- there are no remappings for this peripheral.
The USART3 peripheral uses those pins for TX and RX. On higher pin-count STM32F1 parts, it can be remapped to pins PC10/PC11 or PD8/PD9; however, the STM32F103C8 doesn't have those pins.
There are only two I2C and three USART peripherals on the STM32F103, so there are no alternate I2C or USART peripherals available.
use hardware I2C and as many as possible hardware UARTS. For the additional ones write the software implementation. You have an example here: https://www.st.com/resource/en/application_note/dm00110292.pdf or take stm32F103 with more pins
I am trying to use the Sparkfun nRF52832 breakout board as a master in I2C communication. I am using Arduino IDE to program the module. I defined pins 24 and 25 as SCL and SDA, respectively, and used wire.begin() in the setup to configure it as a master. I expect to see the clock signal when I connect the board to the oscilloscope, but I just see 3.3v dc signals at both scl and sda pins. Would you please tell me what's wrong?
I used pull-up resistors.
I'm having a Chinese development board of STM32F103RCT6 STM32_Mini_Pro where a winbond SPI flash is attached with SPI3. The Chip Select is attached with PA15 pin.
While configuring SPI in STM32 cubeMX, I assign Chip Select i.e. PA15 as GPIO output for software NSS.
But while assigning it i get an error like this
This is my assignment in Cube MX
What is the reason for this problem and how to rectify it?
Thank you
There is no problem. Cube shows you that you can not assign slave select signal to PA15 (yes, it's rigth, you already mapped this pin as GPIO).
Hardware slave select it STM32 micros has the meaning only if you use MCU as slave device.