cancel
Showing results for 
Search instead for 
Did you mean: 

rs232

gerardo2
Associate II
Posted on September 30, 2009 at 12:29

rs232

4 REPLIES 4
gerardo2
Associate II
Posted on May 17, 2011 at 13:23

Hi all,

I'm working on my first stm32 based project, starting from ''HyperTerminal_Interrupt'' example into stm32 fwlib.

I have 2 questions:

1) Both send and receive operations transfer one more character (0xfe during transmit and 0x0d during receive).

Example:

- if TxBuffer contains ''hello'', into pc I see ''xhello'', where 'x' is 0xfe

- if I send ''hello'' from pc to board, RxBuffer contains ''xhello'' where 'x' is 0x0d

Why?

I tried to reduce baudrate from 115k to 9k, but nothing changed

2) This example fires tx_interrupt only at reset, but I'd like to transmit every time I need. I think I have to modify registers (ref um0427).. right?

Thanks

jerry

ccowdery9
Associate III
Posted on May 17, 2011 at 13:23

Can you look on an oscilloscope to examine the data on the TX / RX lines?

Chris.

gerardo2
Associate II
Posted on May 17, 2011 at 13:23

Hi Chris,

Using a third interrupt, USART_IT_TC, problem (1) seems to be solved!

I'm testing a rs232/rs485 converter (between pc and stm32 board). Without this interrupt, I checked the number of transmitted characters, and then move the RTS signal:

if (NumberOfTransmittedChars == NumberOfCharsToTransmit) {

- disable transmit

- enable receive

- move RTS

}

Using an oscilloscope, I saw the transmission also after the RTS move. I don't know the reason.

Now I use the TransmissionCompleteInterrupt. Into this handler, I move the RTS. Now transmit,receive and RTS start and stop at the same time.

About second question..? :)

gerardo2
Associate II
Posted on May 17, 2011 at 13:23

up!

I'd like to transmit every time I need using interrupt (not only after reset!). Is it possible?

Example:

while (1) {

USART1->??? = ???;

Delay(123);

}

Thanks

jerry