2007-03-06 12:24 PM
Two bugs found in 91x_gpio.c and uip_webserver project (IAR EWARM demo)
2011-05-17 12:39 AM
I found two bugs in the uip_webserver project (IAR EWARM demo) that accidentally cancel each other out. This was causing me many hours of grief.
The first bug is that the SCU_GPIOINPUT registers for the MII should be set to 0 (default), but the example code sets them to 1 (GPIO_InputAlt1). see STR912_enet.c, GPIO_InitStructure() et al. The second bug is that there is a bug in 91x_gpio.c that affects GPIO8 and GPIO9. When the example code configures the LCD driver, it accidentally clobbers the SCU_GPIOINPUT register for *GPIO0*, setting to zero, because 8 wraps around to 0 if you have only 3 bits. If you have both bugs in your code, the Ethernet RX accidentally works; otherwise it doesn't work. My ethernet code stopped working when I disabled the LCD! cf The other discussion topic: ''A bug in 91x_gpio.c''2011-05-17 12:39 AM
Hi lakata,
Concerning GPIO(the second bug)you are right, there is a bug in gpio.c as you mentioned and it will be corrected in the next library release. And about the second one, you are talking about P1 and P5 configuration?They are working as output alternate function so as I see the SCU_GPIOINPUT register keep its default value 0. :-W Regards mirou2011-05-17 12:39 AM
P0 and P1 are incorrectly set to Alternate input function instead of the default input. The MII is the default pin function, so SCU_GPIOIN should be zero for both P0 and P1. I believe that P1 is not that important to getting the demo to work (it is for collision detection, carrier sense, and receive error); it works whether the SCU_GPIOIN1 is either 0x00 or 0xFF. But SCU_GPIOIN0 must be zero.
When I stepped through the example, I saw SCCU_GPIOIN0 first be set to 0xFF, then set to 0x00 when the LCD was initialized.2011-05-17 12:39 AM
I forgot to mention, the STR912 library is confusing. The Alt1 input function is not set via the GPIO_Alternate field for the structure, but set by the GPIO_IPConnected field.
This fixes the demo code: // GPIO0 All pins Default Input function GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; GPIO_InitStructure.GPIO_IPConnected = 0; // was GPIO_IPConnected_Enable; GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; GPIO_Init(GPIO0, &GPIO_InitStructure); and same for GPIO1.