Mbed os example wifi

I am using STM32F429ZI and esp8266 wifi module.
On NUCLEO development boards, pins D0 and D1 are used for serial communication with the computer. So I am using pins D8 (to ESP8266 TX) and D2 (to ESP8266 RX) instead. But, after compiling the onboard blue led gets stars blinking.
And if I change pin of STM32 then in a serial console I can see scan -0 networks.
So, please help me with this issue.