how to configure RN xv 171 module for UART communication?
Have you tried telnet to it? that's one way to check if you configured it right.

Also make sure there's a positive communication between the UART module in the stm32f4 and the rn 171 chip itself  (baud rate, parity, etc..)
Default is 9,600 baud, 8 bits, no parity, 1 stop bit and disabled flow control

As far as configuration using Ad Hoc mode,


Set your SSID (XX, last two bytes): WiFly-GSX-XX
DHCP (on or off)
The channel
IP address (to telnet to)
Netmask


p.s. make sure there's an antenna, usually RN131 comes with On-board antenna, not sure about RN171/XV

note: used this manual
http://www.rovingnetworks.com/resources/download/93/wifly_user_manual