Mikroc for arm interrupt problem

Fully featured ARM compilers available on Windows, Linux, and macOS.
Post Reply
Author
Message
sam.123.address@gmail.com
Posts: 11
Joined: 01 Aug 2023 15:25

Mikroc for arm interrupt problem

#1 Post by sam.123.address@gmail.com » 30 Dec 2023 14:30

Hello everyone,

i have a problem using Necto Studio latest version:

i treid many times to use uart3 rx interrupt so when there is data i get interrupt to receive the data through the interrupt handler?

please mikroE i need an example there's no example using necto studio.

Mcu i'm using is mini m4 for stm32 that contains STM32F415RG.

so far i tried to do this but i got error:

Code: Select all

void uart3_config()
{
   //init UART
   /*UART3_Init_Advanced(115200, _UART_8_BIT_DATA, _UART_NOPARITY,
   _UART_ONE_STOPBIT, &_GPIO_MODULE_USART3_PC10_11);*/
   uart_configure_default( &uart_cfg );

   uart.tx_ring_buffer = uart_tx_buffer;
   uart.rx_ring_buffer = uart_rx_buffer;

   uart_cfg.rx_pin = PC11;
   uart_cfg.tx_pin = PC10;
   uart_cfg.tx_ring_size = sizeof( uart_tx_buffer );
   uart_cfg.rx_ring_size = sizeof( uart_rx_buffer );

   uart_open( &uart, &uart_cfg );
   Delay_ms(100);
   // enable uart rx interrupt
   USART3_CR1bits.RXNEIE = 1;
   interrupt_enable(IVT_INT_USART3);// enable interrupt vector
   //Enableinterrupts();
}
/*
This is ISR for UART.
When UART buffer receives data byte it genrates an interrutp
then data will be read and displayed back to the UART.
Data will be stored in an array buffer until ending line CR or LF
is found then stop and storing incoming data.
*/
void UART3_Interrupt() iv IVT_INT_USART3 ics ICS_AUTO{

   uart3_tmp = uart_read( &uart, uart3_rx_buff, sizeof( uart3_rx_buff ) );//uart3_tmp = UART3_Read();  //read DATA byte in tmp
   //uart3_write(uart3_tmp);   //send back data read , uncomment for debugging

   if(uart3_tmp == _LF || uart3_tmp == _CR) //IF  LF IS FOUND
   {
     if(uart3_data_len > 1)  //and if there is data
     {
       uart3_rx_buff[uart3_data_len] = '\0';    //MAKE LAST ELEMENT IN BUFFER AS NULL
       _uart3_data_ready = 1;    //SET DATA READY FLAG
     }
   }
   else  //otherwise read DATA in buffer
   {
      uart3_rx_buff[uart3_data_len] = uart3_tmp;  //READ DATA IN BUFFER
      uart3_data_len++;     //INCREMENT COUNTER TO READ NEXT BYTE
   }
}
//this function resets buffer and variables used with buffer
void reset_buff(char which_uart)
{
  if(which_uart == uart1)
  {
    memset(uart1_rx_buff,0,uart1_data_len); //reset buffer from first index to length used
    //reset variables used with buffer
    _uart1_data_ready = 0;
    uart1_data_len=0;
  }
  if(which_uart == uart3)
  {
    memset(uart3_rx_buff,0,uart3_data_len); //reset buffer from first index to length used
    //reset variables used with buffer
    _uart3_data_ready = 0;
    uart3_data_len=0;
  }
}
and this is the error i get:
Interrupt handler redefined: UART3_IRQHandler at 0x00000037

by the way it works good in mikroc pro for arm but in necto studio it doesn't work.

please i need help i couldn't find any useful solution.

kind regards

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: Mikroc for arm interrupt problem

#2 Post by IvanJeremic » 23 Jan 2024 13:08

Hi,

Sorry for the delay.

Can you zip the folder where your project is located and attach it here?

Regards,

Ivan.

Post Reply

Return to “ARM AI Compilers”