LPC1343 - UART - ATcommands

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1343 - UART - ATcommands

549 Views
jandovrtel
Contributor I

Hello!
I'm creating program when telephone (Siemens M35) rings i get information ''RING'' and after that i would like to send back some AT commands.....

i'm editing this program:
LPCOpen Platform: C:/nxp/v1.03/lpcopen_v1.03/lpcopen/applications/lpc13xx/examples/periph/periph_uar... 

For now i can get the RING and send back AT^SCNI, but problem is when i try to get number with 9 chars, but LPC can take only 8 char number.... I dont know how to make it to take longer words...???

Working for now:

---------------------------------------------------------------------------------------------------------------------
const char inst1[] = "AT^SCNI";

if(key[0] == 'R' && key[1] == 'I' && key[2] == 'N' && key[3] == 'G')
{
Chip_UART_SendRB(LPC_USART, &txring, inst1, sizeof(inst1) - 1);
}
--------------------------------------------------------------------------------------------------------------------

NOT WORKING:

---------------------------------------------------------------------------------------------------------------------
const char inst2[] = "OPEN_DOOR";

if(key[0] == '1' && key[1] == '2' && key[2] == '3' && key[3] == '4' && key[4] == '5' && key[5] == '6' && key[6] == '7' && key[7] == '8' && key[8] == '9')
{
Chip_UART_SendRB(LPC_USART, &txring, inst2, sizeof(inst2) - 1);
}
---------------------------------------------------------------------------------------------------------------------

ANY IDEAS????




FULL PROGRAM CODE:

---------------------------------------------------------------------------------------------------------------------
#include "chip.h"
#include "board.h"
#include "string.h"

STATIC RINGBUFF_T txring, rxring;

#define UART_RB_SIZE 64

static uint8_t rxbuff[UART_RB_SIZE], txbuff[UART_RB_SIZE];

const char inst1[] = "AT^SCNI";
const char inst2[] = "OPEN_DOOR";

void UART_IRQHandler(void)
{
Chip_UART_IRQRBHandler(LPC_USART, &rxring, &txring);
}

int main(void)
{
uint8_t key[64];

Board_Init();
Board_UART_Init();

Chip_UART_Init(LPC_USART);
Chip_UART_SetBaud(LPC_USART, 115200);
Chip_UART_ConfigData(LPC_USART, (UART_LCR_WLEN8 | UART_LCR_SBS_1BIT));
Chip_UART_SetupFIFOS(LPC_USART, (UART_FCR_FIFO_EN | UART_FCR_TRG_LEV2));
Chip_UART_TXEnable(LPC_USART);

RingBuffer_Init(&rxring, rxbuff, 1, UART_RB_SIZE);
RingBuffer_Init(&txring, txbuff, 1, UART_RB_SIZE);

Chip_UART_IntEnable(LPC_USART, (UART_IER_RBRINT | UART_IER_RLSINT));

NVIC_SetPriority(UART0_IRQn, 1);
NVIC_EnableIRQ(UART0_IRQn);


while (1)
{
Chip_UART_ReadRB(LPC_USART, &rxring, &key, 32)

if(key[0] == 'R' && key[1] == 'I' && key[2] == 'N' && key[3] == 'G')
{
Chip_UART_SendRB(LPC_USART, &txring, inst1, sizeof(inst1) - 1);
}

if(key[0] == '1' && key[1] == '2' && key[2] == '3' && key[3] == '4' && key[4] == '5' && key[5] == '6' && key[6] == '7' && key[7] == '8')
{
Chip_UART_SendRB(LPC_USART, &txring, inst2, sizeof(inst2) - 1);
}


NVIC_DisableIRQ(UART0_IRQn);
Chip_UART_DeInit(LPC_USART);

return 1;
}

0 Kudos
1 Reply

354 Views
soledad
NXP Employee
NXP Employee

Hi,

I found another thread with help for you.

[C] LPC1343 - UART - AT commands @ Slo-Tech 

Please check the following document: http://www.dhservis.cz/docs_soubory/at_pro_c35i-gsm_07.07_a_07.05.pdf 

Have a nice day!

Regards

Sol

0 Kudos