Skip to main content
gnyturan
Associate II
June 25, 2013
Question

UART1 setting breakpoint problem

  • June 25, 2013
  • 17 replies
  • 3409 views
Posted on June 25, 2013 at 11:00

Hello all,

I am trying to make the chip to communicate with the PC. My code did not work and I want to debug the code. But I cannot control what happens when data is received. In the debug mode, the code never enters in the interrupt handler. 

How can I see what does the program do when it receives data from the PC?

Thanks a lot in advance.

Best regards,

Gunay

#usart #debug #interrupt #iar
This topic has been closed for replies.

17 replies

frankmeyer9
Associate III
June 25, 2013
Posted on June 25, 2013 at 11:07

In the debug mode, the code never enters in the interrupt handler.

 

Perhaps the interrupt is not properly initialized/enabled. Posting the relevant code could help.

Usually, you can configure the debugger to step in at the reset handler, or at the begin of main. Does that work, can you single-step through your code ?

gnyturan
gnyturanAuthor
Associate II
June 25, 2013
Posted on June 25, 2013 at 11:22

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6ca&d=%2Fa%2F0X0000000brv%2Fzu_T4QwFKoRfNc0u7PPCr4zq_Jp8pkwuwy8_.F69lnE&asPdf=false
frankmeyer9
Associate III
June 25, 2013
Posted on June 25, 2013 at 11:56

I can't spot a grave mistake at first glance.

Does it send, i.e. do you see character transmission ?

It's always good to check with a scope what actually happens at the bus lines.

You have only the RXNE interrupt enabled. This requires a correct character transmission. Can you check that your project sees a proper HSE_VALUE preprocessor definition ?

A common problem is to not have a matching define for this value, which specifies your ext. quartz frequency.

If not defined, a default value of 25.000.000 from stm32f4xx.h (line 104 at my version) takes effect.

gnyturan
gnyturanAuthor
Associate II
June 25, 2013
Posted on June 25, 2013 at 12:47

I'm using a serial port terminal. I could not read any data from the driver. I can send data from PC but don't know what happens to that sent data.

I've checked HSE value, it matches with mine, no problem there. 

frankmeyer9
Associate III
June 25, 2013
Posted on June 25, 2013 at 13:30

I'm using a serial port terminal. I could not read any data from the driver. I can send data from PC but don't know what happens to that sent data.

 

With a level shifter like the MAX232, I hope. Otherwise, the peripheral could be dead already.

Is the wiring correct (RX/TX swapped) ?

How about a scope ?

Something happening on the RX / TX lines ?

gnyturan
gnyturanAuthor
Associate II
June 25, 2013
Posted on June 25, 2013 at 13:37

I'm using a USB to RS422 converter : 

http://www.elektroniktasarim.net/index.php?id_product=17&controller=product

I also used the Eltima software's advanced serial port terminal 5.5

I hope I did not kill anything :D

I could not use a scope yet. I will update the post as I do.

Tesla DeLorean
Guru
June 25, 2013
Posted on June 25, 2013 at 13:50

Does the board have RS422 output? The STM32 has CMOS levels.

Do you see any output from the serial port?

What is GPIO C doing? Controlling an RS422 converter?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
gnyturan
gnyturanAuthor
Associate II
June 25, 2013
Posted on June 25, 2013 at 13:57

The board has RS422 Output.

GPIOC_2 is receive enable (active low) and

GPIOC_3 is device enable for the RS422 transreceiver.

And, no, I don't see anything from the serial port. I just see the data I tried to send from PC. When I send it USB-RS422 converter's data transmission led blinks but the board does not send anything back

frankmeyer9
Associate III
June 25, 2013
Posted on June 25, 2013 at 14:01

I'm using a USB to RS422 converter : ...

 

RS422 is differential, i.e. has RX+, RX-, TX+, TX-, but no GND. Not sure how you would have connected it, and where.

The STM32 UART pins are GND based, CMOS level (3.3V).

I hope I did not kill anything :D

 

I hope so, too.

gnyturan
gnyturanAuthor
Associate II
June 25, 2013
Posted on June 25, 2013 at 14:08

this is the part of the schematic which shows RS422 connections of the board. 

-- I removed the schematic to prevent any trouble. I think clive1 and fm have seen it and found no problems (:

I do not think there is a problem with these because it is a part of a well working board, at least it used to work well (: 

Is it possible to damage it with the code?