This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems using the UART module of the SAMD21

hello, good morning everyone!

I'm having trouble getting the UART of the SAMD21G18A microcontroller to work.

This is the configuration code of the SERCOM 5 module in UART mode:

1.This code is uart.h

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

2.This code is uart.c:

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and this is the function that configures the PB22(Tx) and PB23(Rx) ports as PAD [2] and PAD [3]

3.This code is gpio.h

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

4.This code is gpio.c

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and this is the main

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

According to what I try to do in this code is the ECO, I send and receive the same letter that I write in the PC. But it doesn't work, I made a debug but it stays in this line of code:

"while(UART5.SYNCBUSY.reg&SERCOM_USART_SYNCBUSY_ENABLE); //Espera a que se habilite el UART"


from uart.c, i don't know where the code is wrong. If you could help me I thank you in advance, thank you and have a nice day!

P.D: The operating frequency of the microcontroller is 8MHz and according to me it is asynchronous because it is connected to the GCLK0 which feeds the MAIN

0