Hello everyone!
I have question
I have M2M kit with dev board RCM3200 and wavecom modem but I also have BL2500 with RCM3100.
I am trying to connect modem to BL2500 with RCM 3100.
BL2500 have two (3wire) RS232 ports or one (5wire) port.
I tried to flash sample programs (sampe basic_sms.c) to BL2500 with some modification but no effect.
Can You tell me is this possible?
this is sample of code of basic_sms.c:
#if (_CPU_ID_ >= R3000)
#define PORTA_AUX_IO // needed for the R3k and LCD
#if (_BOARD_TYPE_ < RCM3400A || _BOARD_TYPE_ > RCM3410A )
#define SERB_CTS_PORT PCDR
#define SERB_CTS_BIT 3 // use PC3 as CTS (input)
#define SERB_RTS_PORT PCDR
#define SERB_RTS_SHADOW PCDRShadow
#define SERB_RTS_BIT 2 // use PC2 as RTS (output)
#define MODEM_SERB_ENABLED // Serial Port to Connect Modem to
#define MODEM_SERB_HANDSHAKING // Enables Handshaking (RTS/CTS)
#else
#define SERD_CTS_PORT PCDR
#define SERD_CTS_BIT 3 // use PC3 as CTS (input)
#define SERD_RTS_PORT PCDR
#define SERD_RTS_SHADOW PCDRShadow
#define SERD_RTS_BIT 2 // use PC2 as RTS (output)
#define MODEM_SERD_ENABLED // Serial Port to Connect Modem to
#define MODEM_SERD_HANDSHAKING // Enables Handshaking (RTS/CTS)
#endif
#endif
#define MAX_MODEMS 1 // Number Of Modems to Use (6 max)
#define MDM_WAVECOM 0 // Used in sample only
#if (_BOARD_TYPE_ < RCM3400A || _BOARD_TYPE_ > RCM3410A)
#define BINBUFSIZE 255 // Largest RX Packet Avail.
#define BOUTBUFSIZE 255 // Largest TX Packet
#define MDM_INBUFSIZE BINBUFSIZE // Modem Input Buffer Size
#define MDM_OUTBUFSIZE BOUTBUFSIZE // Modem Output Buffer Size
#else
#define DINBUFSIZE 255 // Largest RX Packet Avail.
#define DOUTBUFSIZE 255 // Largest TX Packet
#define MDM_INBUFSIZE DINBUFSIZE // Modem Input Buffer Size
#define MDM_OUTBUFSIZE DOUTBUFSIZE // Modem Output Buffer Size
#endif
#define GSM_SMS_ENABLE // Enables SMS Text Messaging
// Currently we have two wavecom style modems. One works at 9600, and the
// other auto negotiates up to 115200. This macro allows for modem model
// detection, and if the faster modem is detected, to step the baudrate up
// to 115200.
#define MDM_ENABLE_BAUD_DETECT
#define MDM_DEBUG // Allow For single stepping through library
#define MDM_DEBUG_PRINTF // Display Modem status per functions
// Response message to send when an SMS message is received.
#define GSM_RESPONSE_MSG "MESSAGE RECEIVED"
#define MDM_WAVECOM 0 // Used in sample only
#define MDM_STARTING_BAUD_RATE 9600 // Initial baudrate.
#use "mdm_wavecom.lib" // wavecom specific library
#use "kdu_menu_sms.lib" // KDU Module specific library
// User Defined Modem Setup Function used in the GSM_Initialize function.
void MyModemSetup(long baudrate)
{
#if (_BOARD_TYPE_ < RCM3400A || _BOARD_TYPE_ > RCM3410A)
Modem_Serial_Options(MDM_WAVECOM, M_SERB, baudrate, PARAM_8BIT, PARAM_NOPARITY, 1);
Modem_Signal_Config(MDM_WAVECOM, MODEM_RTS, Modem_WrPortI, PCDR, &PCDRShadow, SERB_RTS_BIT, 0);
Modem_Signal_Config(MDM_WAVECOM, MODEM_CTS, Modem_RdPortI, PCDR, &PCDRShadow, SERB_CTS_BIT, 0);
#else
Modem_Serial_Options(MDM_WAVECOM, M_SERD, baudrate, PARAM_8BIT, PARAM_NOPARITY, 1);
Modem_Signal_Config(MDM_WAVECOM, MODEM_RTS, Modem_WrPortI, PCDR, &PCDRShadow, SERD_RTS_BIT, 0);
Modem_Signal_Config(MDM_WAVECOM, MODEM_CTS, Modem_RdPortI, PCDR, &PCDRShadow, SERD_CTS_BIT, 0);
#endif
// Open Serial Port
Modem_Port_Open(MDM_WAVECOM);
// If not a core, set the serial port mode for 5 wire RS232
#if (_CPU_ID_ < R3000)
serMode(1); // only called if SBC
#endif
}
main()
{
static int sendmsg,InitComplete;
static int fxnchk,Status,Roaming;
static unsigned long lastcompile;
static SMS_INBOX inbox; // For Retrieval of Incoming Message
static int msgstatus; // 1 = Message received, -2 = No Messages Received
static char Phone[20]; // Phone Number string for sending a message
static char Msg[160]; // Message String for sending a message
// Some Codata structures for the various costatements
static CoData RecvSend, SendOnly, Init;
static struct tm TimeDate;
// Init variables
msgstatus = InitComplete = 0;
memset (&inbox,0x00,sizeof(&inbox));
brdInit(); // Initialize SBC (if needed).
// If first compilation, set the time and date to match your PC.
if (lastcompile != dc_timestamp)
{
mktm(&TimeDate,dc_timestamp);
lastcompile = dc_timestamp;
tm_wr(&TimeDate);
SEC_TIMER = mktime(&TimeDate);
}
CoBegin(&Init); // Start the Initialization costate.
for (;;) // Loop forever
{
if ( (InitComplete) && (kbhit()) ) // Check for keypresses
{
CoReset(&RecvSend); // stop and reset the receive costate
CoBegin(&SendOnly); // start the Sending MSG costate
while (kbhit()) getchar();
}
costate Init // Initialization costate
{
// Initialize modem library, and connect to modem
waitfor((fxnchk = GSM_Initialize( MDM_WAVECOM,
5,
1000,
MDM_STARTING_BAUD_RATE,
MyModemSetup)) != MDM_PENDING);
if (fxnchk == MDM_SUCCESS)
{
waitfor(GSM_GetModelID(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].Model));
if (strstr(mdm_chan[MDM_WAVECOM].Model,"G850") != NULL)
{
printf("Increasing Baudrate and disabling Timeout Feature
");
MyModemSetup(115200);
waitfor(GSM_DisableTimeout(MDM_WAVECOM));
}
waitfor(GSM_GetPhoneNumber(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].Pnum));
waitfor(GSM_GetSMSCNumber(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].Cnum));
waitfor(GSM_GetManuFacturer(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].Mfg));
waitfor(GSM_GetPINStatus(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].PINreq));
waitfor(GSM_GetPIN2Status(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].PIN2req));
waitfor(GSM_GetSerNumber(MDM_WAVECOM,mdm_chan[MDM_WAVECOM].Snum));
// SetNetwork Connection
waitfor(GSM_NetworkConnect(MDM_WAVECOM));
// Check the Network Status
waitfor(GSM_GetNetworkStatus(MDM_WAVECOM,&Status,&Roaming) == MDM_SUCCESS);
// Retrieve Phone Number
tm_rd(&TimeDate);
// Set the Modems Time and Date
waitfor(GSM_SetTimeDate(MDM_WAVECOM,&TimeDate));
// Check the modems time and date
waitfor(GSM_GetTimeDate(MDM_WAVECOM,&TimeDate));
// Set the modem to be in SMS mode
waitfor (GSM_SmsInit(MDM_WAVECOM));
printf("
Modem Phone Number is '%s'
",Phone);
printf("
Waiting for SMS Text Message. (Press Any Key to Send Message)");
CoBegin(&RecvSend); // Start the Receiving costate
InitComplete = 1;
}
else // Can't find a modem
{
printf("GSM_Initialize Failed
");
exit(0);
}
}
costate RecvSend // Receiving costate
{
// Check for any new messages
waitfor ((msgstatus = GSM_SmsGet(MDM_WAVECOM,&inbox)) \
!= MDM_PENDING);
if (msgstatus == MDM_SUCCESS) // New message is present
{
printf("
!!Text Message Received!!
");
printf("From: %s
",inbox.dpfp_num);
printf("Time: %s
",inbox.date_time);
printf("Msg: %s
",inbox.txt_msg);
// Check to see if it is a phone message or a website message
if ((strlen(inbox.dpfp_num) > 7) && (strcmp(inbox.dpfp_num+1,Phone)))
{
printf("Sending Response Msg To: %s
",inbox.dpfp_num);
waitfor(DelayMs(2000)); // delay for 2 seconds to allow modem
// to be ready for sending.
// Send the Response message.
waitfor(GSM_SmsSend(MDM_WAVECOM,
inbox.dpfp_num+1,
GSM_RESPONSE_MSG));
}
else
printf("
Invalid Phone Number to respond to (Might be from Website or own phone number)
");
printf("
Waiting For Next SMS Text Message. (Press any key to send a message)
");
}
// wait for 5 seconds before checking again.
waitfor(DelayMs(5000));
// Restart the Receiving costate
CoBegin(&RecvSend);
}
costate SendOnly // Sending MSG costate
{
printf("
Enter Phone Number To Send To (15307573737): ");
// Get the Phone number string
gets(Phone);
printf("
Enter Message To Send: ");
// Get the Message string
gets(Msg);
printf("Sending Message
");
// Send the Message.
waitfor(GSM_SmsSend(MDM_WAVECOM,Phone,Msg));
printf("Message Sent
");
printf("
Waiting For Next SMS Text Message. (Press any key to send a message)
");
CoBegin(&RecvSend); // Start the receiving costate
}
}
}
And I made this modification
// Check for Rabbit 3000 Chip installed
#define SERE_CTS_PORT PCDR
#define SERE_CTS_BIT 3 // use PC3 as CTS (input)
#define SERE_RTS_PORT PCDR
#define SERE_RTS_SHADOW PCDRShadow
#define SERE_RTS_BIT 2 // use PC2 as RTS (output)
#define MODEM_SERE_ENABLED // Serial Port to Connect Modem to
#define MODEM_SERE_HANDSHAKING // Enables Handshaking (RTS/CTS)
#define MAX_MODEMS 1 // Number Of Modems to Use (6 max)
#define MDM_WAVECOM 0 // Used in sample only
#define EINBUFSIZE 255 // Largest RX Packet Avail.
#define EOUTBUFSIZE 255 // Largest TX Packet
#define MDM_INBUFSIZE EINBUFSIZE // Modem Input Buffer Size
#define MDM_OUTBUFSIZE EOUTBUFSIZE // Modem Output Buffer Size
#define GSM_SMS_ENABLE // Enables SMS Text Messaging
// Currently we have two wavecom style modems. One works at 9600, and the
// other auto negotiates up to 115200. This macro allows for modem model
// detection, and if the faster modem is detected, to step the baudrate up
// to 115200.
#define MDM_ENABLE_BAUD_DETECT
#define MDM_DEBUG // Allow For single stepping through library
#define MDM_DEBUG_PRINTF // Display Modem status per functions
// Response message to send when an SMS message is received.
#define GSM_RESPONSE_MSG "MESSAGE RECEIVED"
#define MDM_WAVECOM 0 // Used in sample only
#define MDM_STARTING_BAUD_RATE 9600 // Initial baudrate.
#use "mdm_wavecom.lib" // wavecom specific library
//#use "kdu_menu_sms.lib" // KDU Module specific library
// User Defined Modem Setup Function used in the GSM_Initialize function.
void MyModemSetup(long baudrate)
{
Modem_Serial_Options(MDM_WAVECOM, M_SERE, baudrate, PARAM_8BIT, PARAM_NOPARITY, 1);
Modem_Signal_Config(MDM_WAVECOM, MODEM_RTS, Modem_WrPortI, PCDR, &PCDRShadow, SERE_RTS_BIT, 0);
Modem_Signal_Config(MDM_WAVECOM, MODEM_CTS, Modem_RdPortI, PCDR, &PCDRShadow, SERE_CTS_BIT, 0);
How to make BL2500 to work on one rs232 with cts rts?
Regards