Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9868 Discussions

Using UART to interface a GSM module

JTori
Novice
991 Views

Hello!

I'm starting to work with D2000 uC and I want to connect UART_A to a GSM module and send AT commands. I've done this with other uCs (Cortex-M0, AVR). I read everything I've found about UARTS in d2000 uC and I have some questions. I'm used to write my own tx/rx interrupts and work with a FIFO for tx and another for RX. I'm looking for the correct way to code my app using QMSI.

For example, the "hello world" with a gsm module is to send AT and receive OK.

The transmit part is easy: qm_uart_write_buffer(QM_UART_0, (uint8_t *)"AT\n\r",sizeof("AT\n\r"));

After that command, the module takes some time to answer and send the OK string.

1- the OK string will be available on the RX buffer or should I request a non-blocking IRQ RX transfer? I used to send and wait for a time-out, then analyze the RX buffer for the OK string.

2- if yes, how can I read the RX buffer directly ?

3- if no, I need to setup a xfer, but in the xfer I need to specify the data lenght, but I don't always know the length of the data that I will receive.

thank you,

Jorge.

0 Kudos
1 Solution
Pablo_M_Intel
Employee
78 Views

Hi Jorge,

I believe the second approach would be the correct one to use, request a non-blocking IRQ RX transfer. I'm not sure if you have checked the GitHub examples about UART, if not here's the link https://github.com/quark-mcu/qmsi/blob/master/examples/uart/main.c https://github.com/quark-mcu/qmsi/blob/master/examples/uart/main.c. In that example they set an async_xfer_desc variable, setting the data, data length and callback.

Now to define the xfer, I can't think of an exact way to resolve this issue, but a possible workaround would be to set the length according to the maximum length of the buffer and set a signal that tells when the data has finished.

Regards,

-Pablo

View solution in original post

2 Replies
Pablo_M_Intel
Employee
79 Views

Hi Jorge,

I believe the second approach would be the correct one to use, request a non-blocking IRQ RX transfer. I'm not sure if you have checked the GitHub examples about UART, if not here's the link https://github.com/quark-mcu/qmsi/blob/master/examples/uart/main.c https://github.com/quark-mcu/qmsi/blob/master/examples/uart/main.c. In that example they set an async_xfer_desc variable, setting the data, data length and callback.

Now to define the xfer, I can't think of an exact way to resolve this issue, but a possible workaround would be to set the length according to the maximum length of the buffer and set a signal that tells when the data has finished.

Regards,

-Pablo

View solution in original post

JTori
Novice
78 Views

Thank you Pablo! I will check the example.

Reply