avinash-gupta-in / stm32f051-w5500-mqtt-sub-ex

Example/Demo code for MQTT Subscription on STM32F051+W5500 Setup
0 stars 0 forks source link

Project Document #1

Closed TheSnowFall closed 1 month ago

TheSnowFall commented 1 month ago

Hello,

First of all, I want to thank you for making this repository public and providing valuable resources for beginners like me. I’m currently working on/learning a project with the STM32F103C8T6 (Blue Pill module) and the W5500 Ethernet module. While I’ve successfully adapted your project for the F1 series by replacing the F0 HAL with the F1 HAL, I’m encountering an issue with SPI communication, specifically the W5500 detection.

I receive the following error message:

W5500 NOT Found on SPI Double Check SPI Cables

Despite multiple attempts to resolve this, the issue persists. Here's my wiring setup, which I’ve verified several times:

W5500        >>  Blue Pill (STM32F103C8T6)
-----------------------------------------
MOSI (SI)    >>    PA7
MISO (SO)  >>    PA6
SCK             >>    PA5
CS (SCS)      >>    PA4
RST              >>    PA3

I have not made significant changes to the code other than replacing the F0 HAL with the F1 HAL and changing CS & RST pins in w5500_spi.c. I am trying to gain a better understanding of the code structure.

Could you provide some guidance on potential solutions or debugging steps? It would also be helpful if there was additional documentation, such as the schematic for your F0 chip and W5500 module, to cross-check with my setup for F1.

I am adding my SPI bus signal from the Logic analyzer. Capture_analyzer mcqxqi

Any help would be greatly appreciated!

Thank you.

avinash-gupta-in commented 1 month ago

Please see this

https://www.udemy.com/course/ethernet-on-stm32-using-w5500/

TheSnowFall commented 1 month ago

I solved the issue. The problem I done was in the RST pin and CS pin initialization & calling functions which are in the w5500.c_spi file. According to your MCU these pins were different.

Here is the snippet that I changed.

void  wizchip_select(void)
{
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
}

void  wizchip_deselect(void)
{
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
}

and at the same file:

    GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_3;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

https://www.udemy.com/course/ethernet-on-stm32-using-w5500/

Looks like this is your offered course. I will buy it near soon. I need a lot to learn. Thanks for the offering.