cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 with Discovery: parts needed

scislowski
Associate II
Posted on December 12, 2011 at 17:44

Hi,

I'd like to connect STM32VLDiscovery to my laptop USB via USART.

Everywhere I see that to have RS232 on board it is not sufficient to connect USART pins with DB9 connector. RS232 <-> TTL converter is needed (like MAX3232). 

But if I want connect only to laptop USB (don't need higher voltage than 5V) and I have USB<-> RS232 cable based on Prolific PL-2303. Isn't it enough to connect DB9 directly to Discovery?

 

0690X00000605TbQAI.png

#rs232-discovery-max3232-usart
7 REPLIES 7
Posted on December 12, 2011 at 20:13

You need something like this, which does CMOS SERIAL, not RS232

http://www.dlpdesign.com/usb/txrx.shtml 0690X00000605UoQAI.png
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
scislowski
Associate II
Posted on December 12, 2011 at 20:34

Posted on December 12, 2011 at 21:09

It base on FT232R, which converts RS232 to USB, PL-2303 do the same. Why I need exactly FT232R ?

 

IT DOES NOT DO RS232 LEVEL SIGNALLING, AND CAN USE 3V SIGNALLING, I DO NOT KNOW WHAT YOUR CABLE DOES, YOU HAVE NOT PROVIDED A SPECIFIC CITE OR DATASHEET. THE STANDALONE PL-2303 ALSO DOES NOT DO RS232 LEVEL SIGNALLING EITHER, AND COULD BE ''LIKE'' THE BOARD I SUGGESTED, WHICH IS ''KNOWN TO WORK''.

0690X00000605TgQAI.png
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
scislowski
Associate II
Posted on December 12, 2011 at 22:48

My cable is just this 

http://are.net.pl/?id=products&cmd=9&pid=32

. They made it with PL-2303 and there is no documentation. 

I've connected DB9 (2 -> PA9, 3 -> PA10, 5 -> GND) directly to Discovery and then with mentioned cable and null-modem cable to USB into a laptop. Now something is sended but not signs which I wanted to send e.g. sended: ABCDEFG received: Ph(tQ4&#20; . Code is OK, tested on STM3210B-EVAL. Anybody knows why?

Andrew Neil
Evangelist III
Posted on December 13, 2011 at 23:43

''there is no documentation''

If there is no documentation, and you are unable to test it yourself, then just get rid of it - it is worthless junk.

Get one that is properly documented so that you

know for

sure what it does!

eg, one like this:

http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm

Be sure to choose the appropriate voltage version!

scislowski
Associate II
Posted on December 28, 2011 at 20:59

Finally I bought

http://gostmblogspot.com/2010/09/getting-voltages-right.html

IC - MAX3232 and still have problem. I have connected Discovery <-> MAX3232 <-> RS232 <-> USB. When I made loopback by connection 11 and 12 pin, echo test was OK. So MAX3232<->RS232<->USB is OK. Still have problem with transfer data from/to board. My simple code (I think it should resend data sended from laptop):


#include ''stm32F10x.h''

#include ''STM32vldiscovery.h''




GPIO_InitTypeDef GPIO_InitStructure;

USART_InitTypeDef USART_InitStructure;



u8 USART_data;


int
main(
void
)

{

RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE);



//A.9 USART_1 TX

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

GPIO_Init(GPIOA, &GPIO_InitStructure);


//A.10 USART_1 RX

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

GPIO_Init(GPIOA, &GPIO_InitStructure);


USART_InitStructure.USART_BaudRate = 57600; 

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_InitStructure.USART_StopBits = USART_StopBits_1;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;


//USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

USART_Init(USART1, &USART_InitStructure);

USART_Cmd(USART1, ENABLE);


while
(1)

{

while
(USART_GetFlagStatus(USART1, USART_FLAG_TXE)== RESET)

{

}

USART_SendData(USART1, USART_data);

USART_ClearFlag(USART1, USART_FLAG_TXE);



while
(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET)

{

}

USART_data = USART_ReceiveData(USART1); 

USART_ClearFlag(USART1, USART_FLAG_RXNE); 

}

}

Any advice? 0690X00000605TlQAI.png
jonimatti
Associate
Posted on January 06, 2012 at 08:58

Hello!

Have You initialized the RCC unit?