2012-05-08 02:24 PM
Hi All,
I'm trying to get Nichelite working with the IAR KickStart Kit for STM32F107VC but so far I'm failing and could do with some help. Has anybody managed to get this going? So far, I've got everything to compile by removing some duplicate definitions of standard library functions. I then moved the code from MII mode to RMII mode to allow the Ethernet port to reset correctly and start operating - sort of. Finally I've changed the PHY address from 1 to 21 to match that used on the Kickstart board. Unfortunately, that isn't enough to get things running and I'm now rather stuck. The com port works fine and I have the debug interface working - it just doesn't appear to be sending or receiving any packets. The power up DHCP doesn't work and I can't ping it on its default IP address. Can anybody help me out? #nichelite-iar-stm32f107vc2012-06-03 03:22 AM
Finally got it working.
What you need to do:Install IAR Embedded Workbench 6.3
Install Nichelite Version unknown
Compile – Lots of errors generated in core_cm3.h. Comment out all lines with errors.
Recompile – warnings but no errors.
Stm32.c
line 51 (orig)
from:
#define MII_MODE // MII mode for STM3210C-EVAL Board (MB784) (check jumpers setting)
//#define RMII_MODE // RMII mode for STM3210C-EVAL Board (MB784) (check jumpers setting)
to:
//#define MII_MODE // MII mode for STM3210C-EVAL Board (MB784) (check jumpers setting)
#define RMII_MODE // RMII mode for STM3210C-EVAL Board (MB784) (check jumpers setting)
line 58
from:
#define PHY_ADDRESS 0x01 // for STM3210C-EVAL Board (MB784)
to:
#define PHY_ADDRESS 21 // for IAR STM32F107 Dev Board
line 326 (orig)
from:
/* ETHERNET pins configuration */
/* AF Output Push Pull:
- ETH_MII_MDIO / ETH_RMII_MDIO: PA2
- ETH_MII_MDC / ETH_RMII_MDC: PC1
- ETH_MII_TXD2: PC2
- ETH_MII_TX_EN / ETH_RMII_TX_EN: PB11
- ETH_MII_TXD0 / ETH_RMII_TXD0: PB12
- ETH_MII_TXD1 / ETH_RMII_TXD1: PB13
- ETH_MII_PPS_OUT / ETH_RMII_PPS_OUT: PB5
- ETH_MII_TXD3: PB8 */
/* Configure PA2 as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PC1, PC2 and PC3 as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Configure PB5, PB8, PB11, PB12 and PB13 as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_11 |
GPIO_Pin_12 | GPIO_Pin_13;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* for STM3210C-EVAL: DP83848 PHY */
/**************************************************************/
/* For Remapped Ethernet pins */
/*************************************************************/
/* Input (Reset Value):
- ETH_MII_CRS CRS: PA0
- ETH_MII_RX_CLK / ETH_RMII_REF_CLK: PA1
- ETH_MII_COL: PA3
- ETH_MII_RX_DV / ETH_RMII_CRS_DV: PD8
- ETH_MII_TX_CLK: PC3
- ETH_MII_RXD0 / ETH_RMII_RXD0: PD9
- ETH_MII_RXD1 / ETH_RMII_RXD1: PD10
- ETH_MII_RXD2: PD11
- ETH_MII_RXD3: PD12
- ETH_MII_RX_ER: PB10 */
/* Configure PA0, PA1 and PA3 as input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_3;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PB10 as input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure PC3 as input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Configure PD8, PD9, PD10, PD11 and PD12 as input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOD, &GPIO_InitStructure);
to:
/* ETHERNET pins configuration */
/* AF Output Push Pull:
- ETH_RMII_MDIO: PA2
- ETH_RMII_MDC: PC1
- ETH_RMII_TX_EN: PB11
- ETH_RMII_TXD0: PB12
- ETH_RMII_TXD1: PB13
- ETH_RMII_PPS_OUT: PB5*/
/* Input (Reset Value):
- ETH_RMII_REF_CLK: PA1
- ETH_RMII_CRS_DV: PA7
- ETH_RMII_RXD0: PC4
- ETH_RMII_RXD1: PC5*/
/* Configure PA2 as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PB11, PB12 and PB13 as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure PC1 as alternate function push-pull*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Configure PA1 and PA7 as input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_7 ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PC4, PC5 as input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOC, &GPIO_InitStructure);
line 727 (orig)
from:
/* ETHERNET pins remapp in STM3210C-EVAL: RX_DV and RxD[3:0] */
GPIO_PinRemapConfig(GPIO_Remap_ETH, ENABLE);
GPIO_ENETConfiguration();
GPIO_LEDConfiguration();
ADC_Configuration();
to:
/* ETHERNET pins remapp in STM3210C-EVAL: RX_DV and RxD[3:0] */
GPIO_PinRemapConfig(GPIO_Remap_ETH, DISABLE);
GPIO_ENETConfiguration();
GPIO_LEDConfiguration();
// ADC_Configuration();
The above changes should now see you up and running with the board picking up an IP address from DHCP which you can then connect to via a webbrowser. With just the above changes, the board will start ticking and the ADC is disabled so it won't work.
2012-06-03 05:43 AM
Thanks for sharing your solution