This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interfacing module Sim 900 with TM4C123GXL lauchpad

Hello everyone,

At I said, I tried interface my TivaC Kit TM4C123GXL with Module Sim 900.

But I never get my right result. It always return "ERROR" from module sim.

This is my code.

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"

void UART_Send(uint32_t uart,char* mess){

	while(*mess!=0){
		UARTCharPut(uart, *mess);
		*mess++;
	}
}
void UARTIntHandler2(void)
{
	uint32_t ui32Status;
	ui32Status = UARTIntStatus(UART2_BASE, true); //get interrupt status
	UARTIntClear(UART2_BASE, ui32Status); //clear the asserted interrupts
	UART_Send(UART2_BASE,"AT\r");
	SysCtlDelay(SysCtlClockGet()/100);
	if(UARTCharsAvail(UART2_BASE)){
		printf("%c",UARTCharGet(UART2_BASE));
	}

}
int main(void) {
	SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	GPIOPinConfigure(GPIO_PD6_U2RX);
	GPIOPinConfigure(GPIO_PD7_U2TX);
	GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);
	UARTConfigSetExpClk(UART2_BASE, SysCtlClockGet(), 9600,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
	IntMasterEnable();
	IntEnable(INT_UART2); //enable the UART interrupt

	UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT);
	UART_Send(UART2_BASE,"AT\r");
	SysCtlDelay(SysCtlClockGet()/100);
	while(1){

	}
}

Please help me, because this is my first time I work with this, not my major.

  • Would it not make sense for you to "Step Through" your code - line by line - examining each operation & result? In that manner - you may learn (just) where your code - or remote module - is misbehaving.

    You can build your understanding of the MCU's UART via data exchanges w/your PC. There are many UART examples which guide you & broaden your understanding.
  • Hello Nam.

    PD7 is a locked pin. You would need to unlock the pin before configuring it for UART. Please see the following post for details on the Unlock process.

    e2e.ti.com/.../374640

    Regards
    Amit
  • Thank you so much Amit.
    I'm done with that. I used B0 and B1 instead of PD6 and PD7, everything is OK now.
    And I want to display characters on LCD 1062 with TM4C123 lauchpad.
    Could you help me? Thank you.
  • Nam Nguyen60 said:
    play characters on LCD 1062

    Better attention to detail is (likely) required.   A "1062 Lcd" - really?

    The past (year +) post you've latched onto is rich in detail.   You "pollute" this thread now by steering it from Sim 900 - do you not?   Can that be good?