[DONE] Starting ChibiOS on STM32F107 with Keil

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Giovanni »

A common source of problems are MAC-related pins definitions in board.h. I assume you created your own board files, did you start from the files of the Olimex STM32-P107 board? another thing to check is the clock for the PHY, does it have a dedicated oscillator? did you correctly setup RMII or MII in board.h?

I will re-check the demo application on the Olimex board but this will not necessarily help with your problem, I expect it to work.

Giovanni
Maxxie
Posts: 21
Joined: Mon Mar 18, 2013 2:56 pm

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Maxxie »

Giovanni wrote:A common source of problems are MAC-related pins definitions in board.h. I assume you created your own board files, did you start from the files of the Olimex STM32-P107 board? another thing to check is the clock for the PHY, does it have a dedicated oscillator? did you correctly setup RMII or MII in board.h?
i

My board has same RMII interface but has no dedicated oscillator for PHY. It uses MCO output from STM32 for clocking PHY. I have to activate this output at first.
How do you think, where is the much suitable place for MCO pin activation code?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Giovanni »

Hi,

MCO is programmed using the options present in mcuconf.h, all clock related settings are there. Some users had problems about PHY clock jitter, usually it is better to use a dedicated oscillator.

Giovanni
Maxxie
Posts: 21
Joined: Mon Mar 18, 2013 2:56 pm

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Maxxie »

Giovanni wrote:MCO is programmed using the options present in mcuconf.h, all clock related settings are there. Some users had problems about PHY clock jitter, usually it is better to use a dedicated oscillator.

Yes, the PHY get 50MHz clock from MCO pin without any patching...
The Ethernet functionality on this board was checked early on another project. It works. So it is just software issues.
Maxxie
Posts: 21
Joined: Mon Mar 18, 2013 2:56 pm

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Maxxie »

Using oscilloscope I can see signal on transformer in both directions but no signal on RXD0, RXD1 and RXDV. So PHY don`t receives even brodcast frames from network. It seems PHY configured unproperly.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Giovanni »

I think your same PHY has been reported as working in the past (on the Olimex board rev.B) so I don't think it is a PHY-specific issue. I would re-check the settings of the I(O pins connected to the MAC.

Giovanni
Maxxie
Posts: 21
Joined: Mon Mar 18, 2013 2:56 pm

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Maxxie »

Giovanni,
It seems the problem is in PHY address. Olimex`s board has pull-down resistors for all PHYADx pins of KS8721BL but my not.
What MCU pin state is during PHYADx latching at power-up or reset? I have to take it in account additionally to pull-up and pull-down of KS8721BL.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Giovanni »

Hi,

On reset the GPIO pins are floating however when the MAC driver is initialized the pins state has already been setup as described in board.h.

Verify on the PHY datasheet, it is possible it has internal pull up/down, however the MAC driver scans all addresses in search of the PHY so the final address is not really important. You may try to step into the function mac_lld_init() and see if the PHY is recognized and the address found, this would at least rule out one possible cause of the problem.

Next you may verify if the MAC interrupt is ever triggered.

Giovanni
Maxxie
Posts: 21
Joined: Mon Mar 18, 2013 2:56 pm

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Maxxie »

No, the PHY address was correct. At startup PHY has default address 0x1 caused buy his internal pull-up and pull-down. The function mii_find_phy() works properly. Link goes down and then up during MCU startup when PHY address selected properly.

If you mean CH_IRQ_HANDLER(ETH_IRQHandler), this function never called during runtime.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO] Starting ChibiOS on STM32F107 with Keil

Post by Giovanni »

Yes, I meant that function, it should be called when a frame is received. If you see traffic and it is not triggered then it is a problem between PHY and MAC communication or a clock problem.

Giovanni
Post Reply