Community
cancel
Showing results for 
Search instead for 
Did you mean: 
mgolu
New Contributor II
1,061 Views

UART read or read_irq ?

Hi all,

I wondering what resolution will be better for my application maybe someone of you have a experience and can give me some advice.

Problem description:

I have some application where D2000 is responsible for receiving data (random length of data) via UART from other device and sending it via other interface after small processing.

My device should goes sleep after each data transfer and I wondering if it is possible to wake up device when he received data to UART and how it can be implemented? Maybe someone had similar problem?

Regards,

Frank.

0 Kudos
5 Replies
idata
Community Manager
47 Views

Hi Frank,

Thanks for reaching out.

I think it is possible, because the UART interface has interrupt control, to know how to implement it I recommend you to check the https://downloadcenter.intel.com/download/25619/Intel-Quark-Microcontroller-Software-Interface Intel® Quark™ Microcontroller Software Interface, you will find there the functions to do this (Section 4.22).

Now, if it doesn't work I have an alternative solution: You can add another signal that works as a flag, so you can control the data flow with it and you can use it to wake up the system from any pin when the data is ready. You can use this example as reference for it: https://github.com/quark-mcu/qmsi/blob/master/examples/quark_d2000/power/main.c

I hope you find this information helpful.

Have a nice day.

Regards,

Leonardo R.

mgolu
New Contributor II
47 Views

Hi Leonardo,

thanks for your response currently my solution is based on two additional pins (as you mention flags) but I want to use only UART interrupt to wake it up. I'll check the example maybe it is what I need :-).

Regands,

Frank.

idata
Community Manager
47 Views

Hi Frank,

That's great, let us know if you still need help.

And feel free to share the solution to help the community.

Regards,

Leonardo R.

mgolu
New Contributor II
47 Views

Hi,

now I have something like that (I'm reading 31 of bytes in interrupt function) but I want to based it on uart interrrupts:

void gpio_example_callback(void *data, uint32_t status)

{

qm_uart_status_t uart_status __attribute__((unused)) = 0;

uint8_t cnt = 0;

memset(rx_buffer, 0, BIG_NUMBER_RX);

if ((qm_uart_read(QM_UART_0, &rx_buffer[cnt], &uart_status) == QM_UART_IDLE) && rx_buffer[0]==0x41) {

for(cnt=1; cnt<=BIG_NUMBER_RX-1; cnt++){

qm_uart_read(QM_UART_0, &rx_buffer[cnt], &uart_status);

}

}

if(rx_buffer[BIG_NUMBER_RX-1] == 0xA){

qm_uart_write_buffer(QM_UART_0, (uint8_t *)&rx_buffer, sizeof(rx_buffer));

}

cnt = 0;

memset(rx_buffer, 0, BIG_NUMBER_RX);

}

idata
Community Manager
47 Views

Hi Frank,

These are the functions related to Interrupts with UART:

int qm_uart_irq_write (const qm_uart_t uart, const qm_uart_transfer_t ∗const xfer)

int qm_uart_irq_read (const qm_uart_t uart, const qm_uart_transfer_t ∗const xfer)

int qm_uart_irq_write_terminate (const qm_uart_t uart)

int qm_uart_irq_read_terminate (const qm_uart_t uart)

I found them in the https://downloadcenter.intel.com/download/25619/Intel-Quark-Microcontroller-Software-Interface Intel® Quark™ Microcontroller Software Interface (Section 4.22). To be honest, I don't know exactly how to use them, but I found this link that can be very helpful for you: https://software.intel.com/en-us/articles/using-uarts-on-intel-quark-microcontroller-d2000 Using UARTs on Intel® Quark™ Microcontroller D2000 | Intel® Software

Please check this information and use it as reference, and you can also check this thread:

I hope this information helps you.

Regards,

Leonardo R.