Skip to main content
YAY.1
Senior
Jan 31, 2020 7:55 AM UTC
Solved

Why cortex m4 (stm32 discovery) usart3 is not working ??? (SOFTWARE)

Hello,

I have a problem,i wrote this program but it dosen't work.

It doesn't read its rx pin.

Can you help me pls ???

This topic has been closed for replies.
YAY.1
YAY.1Best answer
Senior
Feb 5, 2020 8:37 AM UTC

NOW, every thing is fine.

It is working...

Final cod that is working :::grinning_face:

14 replies

Ozone
Principal
Jan 31, 2020 8:03 AM UTC

Which discovery board ? There are several one's fitting into the "M4" category.

Have you checked the schematics ?

Perhaps the pin is connected to other onboard peripherals interfering with UART functionality ?

Don't want to wade through uncommented assembler code with permanently cross-referencing the RefManual.

YAY.1
YAY.1Author
Senior
Jan 31, 2020 8:36 AM UTC

Pins are correct (stm32f429ZI).

I try to use Reference manual.

I don't like c language , i want to use assembly language.

Is this program correct ?

And

I will try other pins like uart not usart...

Tesla DeLorean
Guru
Feb 1, 2020 6:49 PM UTC

Can you use a debugger?

Use the Peripheral Viewer to walk through the RCC, GPIO and USART configurations and bits, with respect to the Reference Manual.

Output a 'U' 0x55 pattern repeatedly, and use a scope to confirm the signal and the baud/bit rate.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
YAY.1
YAY.1Author
Senior
Feb 4, 2020 9:08 AM UTC

How can i that ?

Can you explain ?

berendi
Principal
Feb 1, 2020 4:12 PM UTC

Both the software and the hardware has problems. It's quite hard to tell what, when neither the program workings nor the intention is documented.

Using the UART to read from the onboard RAM or what?

Know your board first, use the documentation available from the vendor, then document your code adequately before asking help from others.

Piranha
Principal III
Feb 1, 2020 8:12 PM UTC

> I don't like c language , i want to use assembly language.

I'm all for performance, compactness and understanding of hardware, but writing everything in assembly is just ineffective. It's better to write most of the code in C and leave assembly for hardware specific instructions, performance critical code, startup code etc. Not only you get cross platform decently optimized (for all platforms) reusable code, but also a possibility to change per project optimization for speed or size with a single parameter.

Ozone
Principal
Feb 4, 2020 8:06 AM UTC

I agree.

It's not about C or assembler, it's about self-documenting coding style.

BTW, you can try to loop back the UART for testing, i.e. connecting Rx to Tx.

waclawek.jan
Super User
Feb 1, 2020 8:27 PM UTC

> USART_SR         EQU GPIOD_BASE + 0x00

+1 for using the debugger.

JW

YAY.1
YAY.1Author
Senior
Feb 1, 2020 8:38 PM UTC

USART_SR         EQU GPIOD_BASE + 0x00

This is maybe wrong .

not GPIOD_BASE

it would be this, 0x4000 4800 - 0x4000 4BFF USART3 

I will try this

Thanks a lot.

YAY.1
YAY.1Author
Senior
Feb 4, 2020 6:27 AM UTC

IT doesn't work again......

YAY.1
YAY.1Author
Senior
Feb 4, 2020 6:30 AM UTC

It doesn't work again ....

Even , i have tried to change usart.

Is there a problem in this ?

New cod is here:

YAY.1
YAY.1Author
Senior
Feb 4, 2020 9:20 AM UTC

I think there is no hardware problem ..

What is alternative function low register or high register   ?

I did not touch this settings , can the problem be because of this ???

New cod and this is bluetoth rc car project:

YAY.1
YAY.1Author
Senior
Feb 4, 2020 11:28 AM UTC

It doesn't work again.

Pls help.........

Final cod: