STM32L072 and uart number...

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
orpheedulogis
Posts: 240
Joined: 16 Jan 2010 22:26

STM32L072 and uart number...

#1 Post by orpheedulogis » 16 Aug 2019 12:50

Hi all

Here , just a question: is it possible to use USART4 (or 5) with interrupts ? (for UART number 1 or 2, I use "IVT_INT_USART1" but I can't see any possibility to use other port number).
I'm using STM32L072 and would like to use serial ports 1,2,4,5


Thanks for solutions

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32L072 and uart number...

#2 Post by stefan.filipovic » 20 Aug 2019 14:38

Hi,

According to the STM32L0x2 family reference manual, page 280, you can find USART4/USART5 interrupt under the name IVT_INT_RESERVED6.

Kind regards,
Stefan Filipović

orpheedulogis
Posts: 240
Joined: 16 Jan 2010 22:26

Re: STM32L072 and uart number...

#3 Post by orpheedulogis » 20 Aug 2019 15:41

Hi

Thanks a lot for your answer

I already tried IVT_INT_RESERVED6 (or decimal 30) but it doesn't works.
I was wondering about term "reserved", that's why I was afraid about STM32L072 interrupt possibility for uart4/5 . If it's a problem, I will use a STM32L151 instead.

Can you help me ?

Interrupt
void IntRxTx4() iv 30 ics ICS_AUTO //(or IVT_INT_RESERVED6)
{
Rx4_Ready=1; //never happen
...
}

For interrupt configuration:
NVIC_IntEnable(30);

Update: I found a problem ... on the other board witch provide UART signal...

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32L072 and uart number...

#4 Post by stefan.filipovic » 21 Aug 2019 13:54

Hi,

I'm glad that you have managed to solve this.

Kind regards,
Stefan Filipović

orpheedulogis
Posts: 240
Joined: 16 Jan 2010 22:26

Re: STM32L072 and uart number...

#5 Post by orpheedulogis » 21 Aug 2019 15:21

OK. Some news:

I decided to try using serial port1,2,4,5 to compare results

Code: Select all

    uart1_init(9600);
    uart2_init(9600);
    uart4_init(9600);
    uart5_init(9600);

For better understanding, I removed serial port interrupt and just use this

Code: Select all

while(1)
    {
        ...

        if (UART4_Data_Ready())  // or other number port
        {
             x1=uart4_read(); // or other number port
             bytetostr(x1,Text1);
             Led_Action(1,1,1,5); // just a visual control using timer interrupt
             SSD1306_WriteText(0,1,"Received",0,0);
             SSD1306_WriteText(0,2,Text1,0,0);
             delay_ms(2000);
             SSD1306_WriteText(0,1,"    ",0,0);
        }
  }


And, also, I first removed other board serial transmiter

For serial ports 1,2,5 there is no "received" message
But for serial port 4 , even if no serial board connected, message "Received" appear and data value is "0".

So I still have a problem with serial port 4

Question(solution ?): to use serial port 4, did I have to specify PC10, PC11 ?

Update: I wrote

Code: Select all

UART4_Init_Advanced(9600, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_USART4_PC10_11);
but it doesn't change anything

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32L072 and uart number...

#6 Post by stefan.filipovic » 21 Aug 2019 16:19

Hi,

Are you sure that you did set configuration bits in the Edit Project window properly?

I've just tested all four USART modules on STM32L072VZ and I have not reproduced any issue.

Would you like to zip and attach your project here for inspection?

Kind regards,
Stefan Filipović

orpheedulogis
Posts: 240
Joined: 16 Jan 2010 22:26

Re: STM32L072 and uart number...

#7 Post by orpheedulogis » 23 Aug 2019 16:00

I sent you complete file. Any suggestion ?

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32L072 and uart number...

#8 Post by stefan.filipovic » 26 Aug 2019 13:06

Hi,

Please check your mailbox.

Kind regards,
Stefan Filipović

orpheedulogis
Posts: 240
Joined: 16 Jan 2010 22:26

Re: STM32L072 and uart number...

#9 Post by orpheedulogis » 26 Aug 2019 13:34

Sorry

I can't see anything new on my messages (last message august 22)

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32L072 and uart number...

#10 Post by stefan.filipovic » 26 Aug 2019 14:22

Hi,

I did respond you by an email, not a forum message.
Did you get my email? I will send it once again.

Kind regards,
Stefan Filipović

orpheedulogis
Posts: 240
Joined: 16 Jan 2010 22:26

Re: STM32L072 and uart number...

#11 Post by orpheedulogis » 26 Aug 2019 14:35

Sorry, I didn't look at thi smail box.
Now I can see your answer.
I will do some tests with my analyser and, also, I'm making a new PCB board.

Thanks & regards

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32L072 and uart number...

#12 Post by stefan.filipovic » 26 Aug 2019 14:54

Hi,

You're welcome.

Kind regards,
Stefan Filipović

Global_Industries
Posts: 6
Joined: 11 Apr 2021 16:39

Re: STM32L072 and uart number...

#13 Post by Global_Industries » 11 Apr 2021 16:46

Hello

Sorry to re-open this tread, but I have issue with USART1 on STM32L072

Usart Init compile OK, but if I try to edit register, it said undeclared identifier.

Same register work OK with USART2

Examples:

UE_USART2_CR1_bit = 1;
RE_USART2_CR1_bit = 1; //receiver enable
RXNEIE_USART2_CR1_bit = 1; //rx on
TXEIE_USART2_CR1_bit = 0;

Ok with USART2, but:

UE_USART1_CR1_bit = 1;
RE_USART1_CR1_bit = 1; //receiver enable
RXNEIE_USART1_CR1_bit = 1; //rx on
TXEIE_USART1_CR1_bit = 0;

give Undeclared identifier

Checking STM32L072RZ.c with "ctrl+alt+d" at line 17276, it is there...

USART initialization:

UART1_Init_Advanced(SER1, _UART_8_BIT_DATA, _UART_EVENPARITY, _UART_TWO_STOPBITS, &_GPIO_MODULE_USART1_PA9_10);
UART2_Init(115200);

Look like a bug to me, I'm right?

Thanks

Fred

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: STM32L072 and uart number...

#14 Post by filip » 12 Apr 2021 08:56

Hi,

Try using this :

Code: Select all

UE_bit = 1
RE_bit = 1
RXNEIE_bit = 1
TXEIE_bit = 0
Regards.
Filip.

Post Reply

Return to “mikroC PRO for ARM General”