Other Parts Discussed in Thread: CC2640, SYSBIOS, CC2650
Hello,
I am interfacing SIM5320J gsm module with CC2640 over UART communication. But i did not receive OK response from gsm module. When i am debugging my code and measure voltage level at gsm Power_ON pin i am getting 2.60V. But I am not getting any response from gsm module. Connection of uart TXD and RXD pins are cross connected with gsm txd and rxd . Any one worked on this module please suggest me where i am wrong.
code :
#include "Board.h"
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/BIOS.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/PIN/PINCC26XX.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/drivers/UART.h>
#include <xdc/runtime/System.h>
#include "delay.h"
#include "string.h"
static PIN_Handle pinHandle;
static PIN_State ModbusState;
#define TASK_STACK_SIZE 512
#define TASK_PRI 1
char taskStack[TASK_STACK_SIZE];
Task_Struct taskStruct;
void taskFxn(UArg a0, UArg a1);
#define BUFTYPE char
#define PBUFTYPE char*
#define BUFSIZE 15
UART_Handle hUART;
BUFTYPE txBuf[] = "AT\r";
BUFTYPE rxBuf[2];
UART_Params params;
Semaphore_Struct sem;
Semaphore_Handle hSem;
static void uartRxCb(UART_Handle handle, void *buf, size_t count) {
Semaphore_post(hSem);
}
void taskFxn(UArg a0, UArg a1) {
pinHandle = PIN_open(&ModbusState, BoardGpioInitTable);
PIN_setOutputValue(pinHandle, PIN_ID(Board_EN_VBUS), Board_EN_VBUS_OFF);
delay_ms(100);
PIN_setOutputValue(pinHandle, PIN_ID(Board_MODEM_PWR_EN), Board_MODEM_PWR_EN_ON); // modem power supply
delay_ms(1000);
// PIN_close(ModbusHandle);
if(Board_MODEM_PWR_PGOOD) {
PIN_setOutputValue(pinHandle, PIN_ID(Board_MODEM_CONTROL), 0);
delay_ms(50);
PIN_setOutputValue(pinHandle, PIN_ID(Board_MODEM_CONTROL), 1);
delay_ms(120);
PIN_setOutputValue(pinHandle, PIN_ID(Board_MODEM_CONTROL), 0); // Enable GSM power on
delay_ms(4000);
}
else {
System_printf("Power not Good\n");
PIN_setOutputValue(pinHandle, PIN_ID(Board_MODEM_PWR_EN), Board_MODEM_PWR_EN_ON);
delay_ms(100);
}
UART_Params_init(¶ms);
params.readMode = UART_MODE_CALLBACK;
params.writeMode = UART_MODE_BLOCKING;
params.readCallback = uartRxCb;
params.readEcho = UART_ECHO_OFF;
params.dataLength = UART_LEN_8;
params.stopBits = UART_STOP_ONE;
params.baudRate = 115200;
hUART = UART_open(CC2650_UART0, ¶ms);
Semaphore_Params sParams;
Semaphore_Params_init(&sParams);
sParams.mode = Semaphore_Mode_BINARY;
Semaphore_construct(&sem, 0, &sParams);
hSem = Semaphore_handle(&sem);
PIN_close(pinHandle);
UART_write(hUART, txBuf, sizeof(txBuf));
delay_ms(1000);
UART_read(hUART, &rxBuf, sizeof(rxBuf));
Semaphore_pend(hSem, BIOS_WAIT_FOREVER);
if((strstr(rxBuf,"OK")) || (strstr(rxBuf,"ok"))) {
System_printf("AT : OK");
}
else {
System_printf("Error...");
}
}
int main(void) {
PIN_init(BoardGpioInitTable);
Task_Params params;
Task_Params_init(¶ms);
params.priority = TASK_PRI;
params.stackSize = TASK_STACK_SIZE;
params.stack = taskStack;
Task_construct(&taskStruct, taskFxn, ¶ms, NULL);
BIOS_start();
}
Regards,
Rajneesh


