wizchip_reset() does not fully configure GPIO
Opened this issue · 0 comments
AmeNote-Michael commented
The routine wizchip_reset() in w5x00_spi.c does not properly configure the GPIO used to reset the wisnet chip leaving it to randomly work. Need to make sure to perform a gpio_init(PIN_RST) before setting direction and using. Below is example code of how I fixed this issue.
void wizchip_reset()
{
static bool isConfigured = false;
if ( !isConfigured )
{
gpio_init(PIN_RST); // Initialize as a GPIO
gpio_set_dir(PIN_RST, GPIO_OUT); // Configure as an output
isConfigured = true;
}
gpio_put(PIN_RST, 0);
sleep_ms(100);
gpio_put(PIN_RST, 1);
sleep_ms(100);
bi_decl(bi_1pin_with_name(PIN_RST, "W5x00 RESET"));
}