Dear Community Experts,
Device: ATSAMD20-XPRO
IDE: Atmel Studiov7
Framework: ASF
I am trying to implement a UART communication between ATSAMD20-XPRO and GSM module. Here I wish to store the contents of a received SMS (GSM) on ATSAMD20's EEPROM.
Separately, the UART communication between ATSAMD20 and GSM works fine, I have used USART Callback method. Also, ATSAMD20 EEPROM read/write works fine.
When combined the above, I faced issues in restoring complete buffer containing responses of the GSM module, like currently I had placed the "usart_read_buffer_job" function in a while loop with a condition till the buffer gets a "K", also copying the buffer data into another buffer2 for further use. Although, SAMD20 UART prints the received response without any data loss, but it fails to retain the data in the buffer and hence even buffer2 has NULL data.
Irrespective of the initialized buffer size, every received character (response from GSM) overwrites at 1st element, probably this is a normal behavior.
I tried implementing using "buffer[i]" and later in the same loop "i++", but it again failed, I don't understand why it fails, at least the immediate copying should have worked.
Kindly, help me out here. Also if implementing Ring-buffer like logic is the only solution for this, then please share how it can be implemented in this USART callback type of code, I have tried implementing ring-buffer logic but have failed in doing it effectively.
Thank you.