Skip to main content
yjae
Associate II
August 24, 2018
Solved

Can you tell me how to set up serial port in keil?

  • August 24, 2018
  • 27 replies
  • 5191 views

I'm a beginner. I'd appreciate your help.

This topic has been closed for replies.
Best answer by Tesla DeLorean

The L073RZ is capable of using DMA for USART4, the VCOM.C is not illustrative of this, but there might be examples under the HAL trees.

STM32Cube_FW_L0_V1.10.0\Projects\STM32L073RZ-Nucleo\Examples\UART\UART_TwoBoards_ComDMA

27 replies

yjae
yjaeAuthor
Associate II
August 27, 2018

void USART4_5_IRQHandler(void)

{

..

}

What is this part?

Is it true that there is no content?

Tesla DeLorean
Guru
August 27, 2018

This would be the body for a handler routine which would need to exist if you are generating interrupts. The vector table would cause it's execution.

You'd need to add your own servicing code.

>>I'm a beginner. 

Need to learn how the processor functions, try some of Joseph Yiu's books, perhaps the Essential Cortex-M0 one if that's your initial target.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
yjae
yjaeAuthor
Associate II
August 29, 2018

umm

yjae
yjaeAuthor
Associate II
August 29, 2018

Thank you. I ordered a book.But I don't have enough time.

Did you usart4 on pc10,pc11? (Source above)I'm confused because it's different from what I made out of Cubemx. Ping-pong works well with the sauce you gave me.

Tesla DeLorean
Guru
August 29, 2018

CubeMX does things differently, mainly spreading code all over the place, I prefer to use SPL/HAL where I put all the initialization in one place, where the order/sequence is clearer and more apparent. I don't particularly like CubeMX, and the output is going to be hard to integrate with the LRWAN code which is a hybrid of the Semtech stack and HAL using the RTC as a timebase.

The VCOM.C provides some example of how to interact with the USART

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
yjae
yjaeAuthor
Associate II
August 29, 2018

I see. Thank you.by the way, The source says 'GPIO_InitStructure.Pin = GPIO_PIN_10 | GPIO_PIN_11;'. I set pc10,pc11 as usart4, is this correct?

Tesla DeLorean
Guru
August 29, 2018

The pin list is a bit vector, you can use it to describe multiple pins on the given GPIO Bank

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
yjae
yjaeAuthor
Associate II
August 31, 2018

​thank you friend There is another question. can use dma?(above source)

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
August 31, 2018

The L073RZ is capable of using DMA for USART4, the VCOM.C is not illustrative of this, but there might be examples under the HAL trees.

STM32Cube_FW_L0_V1.10.0\Projects\STM32L073RZ-Nucleo\Examples\UART\UART_TwoBoards_ComDMA

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
yjae
yjaeAuthor
Associate II
August 31, 2018

​so

 __HAL_RCC_USART4_CLK_ENABLE();

 __HAL_RCC_GPIOC_CLK_ENABLE();

I fixed it like this.

(This way there is no error.)