Hi,
I really would like to be able interface with the modem at the lowest possible level. I got the bsdlib working.
I use the following procedure to send AT commands and receive responses:
init:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
static void init(N91LTE_Context* pContext)
{
NVIC_SetPriority(BSD_APPLICATION_IRQ, BSD_APPLICATION_IRQ_PRIORITY);
NVIC_EnableIRQ(BSD_APPLICATION_IRQ);
NVIC_SetPriority(BSD_NETWORK_IRQ, BSD_NETWORK_IRQ_PRIORITY);
NVIC_EnableIRQ(BSD_NETWORK_IRQ);
bsd_init();
pContext->socket_fd = nrf_socket(NRF_AF_LTE, 0, NRF_PROTO_AT);
ASSERT(pContext->socket_fd != -1,"AT socket error");
}
send:
Fullscreen
1
sizeSend = nrf_send(pContext->socket_fd, pData, size, 0);
receive:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void bsd_os_errno_set(int err_code)
{
/* Variables */
N91LTE_Context* pContext = NULL;
/* retrieve context */
pContext = sContext;
/* save last known error code */
pContext->errorCode = err_code;
}
void BSD_APPLICATION_IRQ_HANDLER() //EGU1_IRQHandler
{
/* Variables */
N91LTE_Context* pContext = NULL;
/* retrieve context */
pContext = sContext;
/* bsdlib requires this function to be called on application interrupts */
when I use a buffer of 1000 bytes and send the 'AT+CGMR' command, I get 'mfw-m1_nrf9160_0.6.8-30.alpha<CR><LF>OK<CR><LF><NUL>' as a response. Great!
But when I use a buffer of 10. I expect to able to use multiple nrf_recv calls to get the rest of the data. But the rest is not there anymore.
I only get 'mfw-m1_nrf', and the rest is not returned when i call 'nrf_recv' again.
Is this expected behaviour? Do I need to allocate a massive buffer to be sure I always get all of my data?