STR912FAW44 I am using SSP1 in master mode, Motorola format, to communicate with a serial flash device from Atmel. SSP1_MISO is connected to P3.5. Everything works fine. Then, I initialize the MAC controller, and bang! Can't read anything other than 0's on SSP1_MISO ! As soon as I configure the MAC contoller's P1.2 as an output pin (MII_TXD1), it seems like SSP1_MISO becomes disabled. Using a scope, I see a perfectly normal SPI transaction, and the correct data from the serial flash arrives at P3.5. But the FIFO contains 0's ! Funny observation: P1.2 (MII_TXD1) also happens to be an alternate input function for SSP1_MISO. It's almost like configuring P1.2 as an output pin causes not only P1.2 to be unusable for SSP1_MISO, but P3.5 as well... Anyone has an idea ??? I could post my code, but I'm not at work at this moment... [ This message was edited by: spigeon on 12-02-2008 14:25 ]
Found the problem and I am rather angry that I had to spend a whole day looking for the answer.
When configuring P1.2 (MII_TXD2), it should be: GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable; instead of : GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; IPConnected_Enable only applies to input pins - this raises the AltInput1 bit in the SCU_GPIOIN register. Therefore, I had SSP1_MISO enabled on P1.2 and on P3.5, which is illegal. But the damned line with IPConnected_Enable was taken from source code that came with my IAR compiler (web server example on the STR912-SK, using uIP), here: C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\examples\ST\STR91x\STR912-SK-IAR\uip_webserver\modules\str912_enet.c