Closed jensModvig closed 2 years ago
I just double-checked. I am able to send a message 144 characters long using text-mode and custom written code, but I am not able to do the same using serialport gsm.
I would love if somebody could test it too, too see if it is an error caused by SIM800L's PDU mode or a problem with serialport gsm
let str = ''; for (let i = 0; i < 144; i++) { str += 'a'; }
Hi @jensModvig ! I'm sorry but I can't help you right now, the devices I use for testing are not with me right now at home. (they're at the office).
Hi I am having the same issue as @jensModvig. I am able to send a message up to 140 characters fine, 141 no error but does not send and anything larger sends back "+CMS ERROR: 325" input error. The input I tried is just "aaaaaaaaa" repeated.
let options = { baudRate: 9600, dataBits: 8, stopBits: 1, parity: 'none', rtscts: false, xon: false, xoff: false, xany: false, autoDeleteOnReceive: true, enableConcatenation: true, incomingCallIndication: true, incomingSMSIndication: true, pin: '', customInitCommand: '', logger: console }
The device I am using is a Sim800C which is the USB version on COM5 Port.
@zabsalahid I am having the same issue as @twgrops and @jensModvig. Is there any idea on when this will be fixed?
Does someone of you can develop nodejs andcame have a look? I'm sure @zabsalahid is happy to take an PR that fixes it ... else you need to wait till someone finds the time to reproduce it. You could also help by proving example code that always triggs the error . You could enable debug and provide an exact debug log for the issue.
Sorry guys I still can't help you on that. I still don't have access to modem for testing due to this pandemic
No worries, I will do my best to have a look at it over the weekend. If I can fix it, I'll let you know.
Hi @Apollon77 here is an example of code I was working with
/**
* Modem.js handles all the settings to run the serial port sim800c device
*
* Code based on serialportgsm node package found https://www.npmjs.com/package/serialport-gsm
*/
const serialportgsm = require('serialport-gsm')
let modem = serialportgsm.Modem()
/**
* Options for the sim800c controller
*/
let options = {
// Rate at which information is transferred - 9600 to 115200 bps
baudRate: 9600,
// Number of bits for each character - 8bits has become universal as it is a byte - https://en.wikipedia.org/wiki/Serial_port
dataBits: 8,
// Stop bits 1 or 2 used for adding processing time with higher baud rates - https://www.mathworks.com/help/instrument/stopbits.html#:~:text=end%20of%20byte-,Description,the%20end%20of%20data%20transmission.
stopBits: 1,
parity: 'none',
// Flow control settings - https://en.wikipedia.org/wiki/Software_flow_control
rtscts: false,
xon: false,
xoff: false,
xany: false,
// Delete from our 'sim' after receiving
autoDeleteOnReceive: true,
// Allows multi incomming message received to be concatonated
enableConcatenation: true,
// Allows indication of call incomming
incomingCallIndication: true,
// Allows indication of sms incomming
incomingSMSIndication: true,
// If sim card is pin locked enter the pin here
pin: '',
// Custom initialise commands - used after pin check - expected to return 'OK' (Empty means no custom command)
customInitCommand: '',
// Provide a logger instance, 'debug' is used only to output written and received serial data. Use 'console' for debugging purposes.
logger: console
}
//Make sure com port is the number in device manager
modem.open('COM4', options,{});
/**
* Modem is initialised here
*/
modem.on('open', (data) => {
// Initialise the modem
modem.initializeModem((data)=>{
modem.sendSMS("0749777xxxx", "Test message", false, (data)=>{})
});
})
/**
* Export module app
*/
module.exports = modem
Here are some examples to replace and try please make sure phone number is correct
//141 chars and fails error +cms 325 - invalid input
//modem.sendSMS("0749777xxxx", "This is a long test string for testing the sms. This is a long test string for testing the sms. This is a long test string for testing the sms.", false, (data)=>{})
//140 chars and works
modem.sendSMS("0749777xxxx", "This is a long test string for testing the sms. This is a long test string for testing the sms. This is a long test string for testing the s", false, (data)=>{})
I can try to find time after my vacation ... whated to restart my work on this also after the vacation :-) But maybe someone else is faster ;-) @AlexHodson thank you!
Any update on when this can be fixed? I have an automatic SMS setup that crashes now and then because of this bug. I really don't want to be annoying, I just wanted to communicate that it is still important, if someone that understand the code can find time.
I haven't been able to resolve the issue yet. Just for clarity @jensModvig, has it ever been able to send large text in your implementations?
@AlexHodson Do you mean if it was ever possible to send messages of the length 142-148 (inclusive) characters in previous versions? I don't think so, I don't have any proof that it once worked. I have run my implementation on older versions, but I didn't notice the bug. But I believe I was just lucky, since I didn't send as many messages back then.
I've had another look at this, and I don't think it is anything to do with the serialport-gsm package directly. The package depends on the node-pdu package which seems to be what is causing the problem. I am currently working on a potential fix, will hopefully have a PR soon.
I am so happy to hear that!
@AlexHodson I just downloaded your pull request from your github, and tried sending a message 144 characters long, sadly It still crashes :( Exactly the same error
@jensModvig it should work for 7 bit and 16 bit. I can see you are using 8 bit. I will have another look for 8 bit messaging
@jensModvig I've tested using 8 bit on my board and it works fine sending standard SMS. Are you trying to send a class 0 message (Flash Message)?
@AlexHodson I am sending a normal message. It still doesn't work for me, I have attached a script, to reproduce the error. You have to change two constants (NUMBER and SERIAL_ADDRESS) to make it work for you. testSMS.zip When running the script you should first recieve a SMS saying "hey" followed by an error printed to console (because it tries to send a message of 144 character length)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
really solved?
It is not solved
... and I verified it :-)) @zabsalahid can be closed!
For those, facing issue from AT Command,
Use
AT+CMGF=1
to change to Text Mode.
Then, you can continue on your message depending on the carrier service.
@zabsalahid can be closed
I still can't send sms length that is over 140+. May I know the changes needed for this to work?
Please provide a Debug log
When sending a SMS, with a length of anywhere in-between 142-148 (inclusive) characters, the modem (im using sim800L) sends back "+CMS ERROR: 325", from which i understand is an input-error. According to the internet, the SMS limit is 160 characters, and I believe this might be a serialport-gsm error, I am not sure though, and I might have setup the communication wrong. The module is using firmware version 1418B04SIM800L24 and my serialport-gsm options are:
let options = { baudRate: 115200, dataBits: 8, stopBits: 1, parity: 'none', rtscts: false, xon: false, xoff: false, xany: false, autoDeleteOnReceive: true, enableConcatenation: true, incomingCallIndication: false, incomingSMSIndication: false, pin: '', customInitCommand: '', //logger: console }
On top of that, when sending 141 characters exactly, no error is thrown, but the SMS never gets sent, but anything below that seems to work. I am also able to send longer messages of around 440 characters no problem. Is anyone else experiencing this problem? I apologize if it is a mistake on my part.