Expert advice needed on SAMV71 with ASFV4 (callback issue)

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

 

Following is my program where I have configured SAMV71 as ASYNC I2C SLAVE with address 0x70. Parallelly I want to read 8 bytes serial data using USART SYNC. When i execute the below program I2C Slave responses to the master perfectly but USART Communication is not working. Both were working separately without a problem but when I combine together only I2C Works. 

 

struct io_descriptor *io;
struct io_descriptor *uart;

uint8_t data_in[4];

uint8_t dataArray_C_SEL_ARRAY[35]  = {0x02,0x00,0x43,0x4f,0x4e,0x54,0x49,0x4e,0x45,0x4e,0x54,0x41,0x4c,0x20,0x32,0x30,0x32,0x34,0x30,0x30,0x20,0x32,0x30,0x32,0x34,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63};
 

static void   I2C_0_rx_complete_new(const struct i2c_s_async_descriptor *const descr)
{
    uint32_t j = io_read(io, &data_in, 1);

    if (data_in[0]) { 

        io_write(io, &dataArray_C_SEL_ARRAY,35);

        }

}

 

int main(void)
{
    
    atmel_start_init();

 

    USART_0_init();

    usart_sync_get_io_descriptor(&USART_0, &uart);
    usart_sync_enable(&USART_0);

 

    I2C_0_init();

    i2c_s_async_get_io_descriptor(&I2C_0, &io); 
    i2c_s_async_register_callback(&I2C_0, I2C_S_RX_COMPLETE, I2C_0_rx_complete_new);
    i2c_s_async_set_addr(&I2C_0, 0x70);
    i2c_s_async_enable(&I2C_0);

    while (1) {
        
    io_read(uart,&SER_ARRAY , 8);

   

}

}

 

 

I debugged the program in Atmel Studio, my observation was the control not return back to main() from the Interrupt handler. Please help..!

Last Edited: Sat. Oct 23, 2021 - 04:50 AM