-
I am calling it a day now... I figured out the problem. After trying 3 espruinos and multiple NRF modules I kept getting 255 on one board and 30 on the other board. I read somewhere that the 255 was an issue with maybe the MOSI but I checked wiring at least 10 times. I ended up putting all new cables on the NRF to espurino and I'm back in action.
-
I am having all kinds of trouble today lol.
I am trying to get these two radios working again. I had them working in the past but have not been successful today even when trying the most basic example.
https://www.espruino.com/NRF24L01P
I have one espurino attached to a macbook pro USB plugged into the web ide with the following code:
SPI1.setup({sck:A5, miso:A6, mosi:A7}); var nrf = require("NRF24L01P").connect( SPI1, B0, B1 ); function onInit() { nrf.init([0,0,0,0,1], [0,0,0,0,2]); } onInit(); setInterval(function() { nrf.slaveHandler(); }, 50);
On another macbook pro I have an espurino plugged into the usb with the web ide open. On that one I have the following code:
SPI1.setup({sck:A5, miso:A6, mosi:A7}); var nrf = require("NRF24L01P").connect( SPI1, B0, B1 ); function onInit() { nrf.init([0,0,0,0,2], [0,0,0,0,1]); } onInit(); setInterval(function() { nrf.masterHandler(); }, 50);
On the master once I pushed the code I then try the following from the console:
nrf.sendCommand("1+2", function(r) { print("=="+r); });
When I do that I get the error:
TX not received 30
If I swapped the two pieces of code and make the first the master I get this error:
TX not received 255
I have checked my wiring at least 10 times on both NRF24L01P. I used the pin instructions found here https://www.espruino.com/NRF24L01P for my two original espruino boards.
Any insight or tips to debug would be really appreciated.
-
-
I am using the following Maxbotix sensor:
http://www.maxbotix.com/Ultrasonic_Sensors/MB7334.htm
I have it working where I connect to Serial3 and have a callback attached on the 'data' and I am console logging the returned value from the sensor.
The problem I have having is I have PIN 4 connected to B10 and PIN 5 connected to B11. Their document has that PIN 4 is internally pulled high so if it will continually ping for a reading. If you pull the pin low it will not and if you pull it high for a short period of time it will take a reading.
Am I pulling the pin B10 low incorrectly? My goal was to connect via Serial, pull the pin low, then every 60 seconds pull the pin high which would cause it to read data and then after 10 readings it would send off the reading and set the pin back to low. In production the 60 second interval may be something more like 5 or 10 minutes. I wanted it to not be reading, then take 10 measurements every X mins and use that last one then turn it back off.
I just can't get the LOW/HIGH pin stuff right on B10 for their PIN4. Am I missing something simple?
var interval = 60000; var readingInterval = 10; var fullReading = ""; var readingCount = 0; Serial3.setup(9600, { rx: B11, tx: B10, bytesize: 8, parity: false, stopbits: 1 }); B10.write(false); var pulseLed = function(){ digitalPulse(LED1,1, 100); }; var handleData = function(data){ if(data == 'R'){ console.log("NG:", fullReading); ++readingCount; pulseLed(); if(readingCount == readingInterval){ B10.write(false); readingCount = 0; console.log("Got final Result:", fullReading); } fullReading = ""; } else { fullReading = fullReading + data; } }; Serial3.on('data', handleData); setInterval(function(){ console.log("Run Interval"); B10.write(true); }, interval);
From their document:
Pin 4- Ranging Start/Stop: This pin is internally pulled high. If this pin is left unconnected or held high, the sensor will
continually measure and output the range data. If held low, the HRXL-MaxSonar-WRS will stop ranging. Bring high for
20uS or longer to command a range reading.
Filtered Range Data: When pin 4 is left high on the sensors, the sensors will continue to range. The data that is output
includes a filter for increased accuracy. The sensors will output the range based on recent range information. The filter
does not affect the speed at which data is made available to the user but instead allows for more consistent range
information to be presented. For sensor specific timing and filter information refer to pages # and #.
Real-time Range Data: When pin 4 is low and then brought high, the sensor will operate in real time and the first reading
output will be the range measured from this first commanded range reading. When the sensor tracks that the RX pin is low
after each range reading, and then the RX pin is brought high, unfiltered real time range information can be obtained. For
timing information please refer to pages # and #. -
So if the AT+FOO would return 3 lines and you really just cared about FOOTwo you would just maybe issue a wait or a SetTimeout for the AT+BAR command to ensure all of the AT+FOO response lines have been either handled or flushed?
It is just weird that the callback handler for AT+BAR may get a response from AT+FOO. I would have thought the returned lines from the AT+FOO would be somehow indexed to that cmd and only that callback could/would get called for its returned lines. I guess though that can't happen because you don't know what response from the modem is tied to what command... now that I type this out I get why it works the way it does.
Now that I have a deeper understanding of this.. I may just go ahead and tackle a rewrite on the SIM900 module.
-
Thanks for the VIO info. I did get it to work by connecting the 3.3 on the Espruino to the VIO on the SIM800.
I have another question and I'm not sure how to word it so I'll do my best. Currently the AT module will call the linecallback function if a function is returned. Here is a problem I 'think' I am seeing.
Lets for argument say that an AT command "AT+FOO" is going to return a 3 line response of
OK
SUPER DUPER
OMG
If my callback gets called for OK and I return my same handler it will get called again with SUPER DUPER as the param. I am looking for SUPER DUPER so I call my next AT command in my sequence of calls. That linecallback I pass to that AT command will first get called with OMG before it gets called with the resulting lines from my second AT command. Does that make sense? Shouldn't the AT command call basically flush any pending lines that have not been handled? Am I understanding that wrong?
-
Can someone verify my understanding of the AT module is correct. It looks like it will continue to call your callback that you pass to the at.cmd for each line of data it encounters until the timeout occurs which then it calls your callback with no params. Is that a correct view? If so, does this pseudo code work for dealing with a multi-line response from an at cmd where you are looking for a certain response.
var somInitFunc = function(callback){ //This will get called for each line of data. If we return a func it will continue to be called //for each line. On timeout, it will get called with no params. var myLineCallback = function(d){ if(!d){ return callback("Error in SOMECOMMAND"); } if(d === 'ANSWER I WANT'){ //got a success keep going } else { //just return self b/c we can get multiple lines of extraneous responses from this cmd return myLineCallback; } }; //This command returns multiple lines of data that we need to handle. at.cmd('AT+SOMECOMMAND\r\n', 1000, myLineCallback); };
-
-
-
I do have a question... In the sim900 module it issues the "AT+CIPSTATUS" command and what is returned from the AT module is just the first line of the response. Is there a way to get the entire response so I can compare that properly to the "STATE: IP INITIAL" response the module wants to compare.
Connecting to SIM900 module
] "\x00" <--- "\x00"
Got back
["ATE0\r\n"
] "\x00\r\nOK\r\n" <--- "\r\nOK\r\n"
["AT\r\n"
OK
["AT+CPIN?\r\n"
] "\r\nOK\r\n\r\n+CPIN: READY\r\n\r\nOK\r\n" <--- "\r\nOK\r\n\r\n+CPIN: READY\r\n\r\nOK\r\n"
OK
["AT+CGATT?\r\n"
+CPIN: READY
["AT+CIPSHUT\r\n"
OK
["AT+CIPSTATUS\r\n"
] "\r\n+CGATT: 0\r\n\r\nOK\r\n\r\nSHUT OK\r\n\r\nOK\r\n\r\nSTATE: IP INITIAL\r\n" <--- "\r\n+CGATT: 0\r\n\r\nOK\r\n\r\nSHUT OK\r\n\r\nOK\r\n\r\nSTATE: IP INITIAL\r\n"
+CGATT: 0
Error in 4: +CGATT: 0 -
I now have my problem resolved... after thinking more about it I was supplying to much voltage to the sim800L. I was giving it 5V and it has a max of 4.2 (4.4 depending on where I read). After wiring up some 1.2V 2250mah AA's to get ~3.8V it is now running just fine.
Now I just have to rewrite the sim900 espruino module for this thing to boot... its at least responding now!
-
I could really use some help. I have an Espruino (http://www.espruino.com/EspruinoBoard). I am trying to connect the fona (https://learn.adafruit.com/adafruit-fona-mini-gsm-gprs-cellular-phone-module/pinouts) to our board.
As of right now I have the fona powered by an external 5v power source plugged into the JST port. I also have the VIO pin plugged into the VBAT of the Espruino. I have the KEY pin plugged into a GND on the Espruino. I have the RST plugged into my B4 gpio on the Espruino.
When I try to issue a command to the fona I get errors in my console that says "Boot Failed, Reset". Our code issues a reset on the B4 pin to reset the modem each time we turn it on.
We want to connect the fona in an 'Always On' configuration and connect to it via serial on the espruino to send http requests. Not sure if that helps. I connected the KEY pin bc the way I read the docs the module is OFF by default and you need to connect KEY to ground to have it always on... maybe I read that wrong too. :(
I think I fundamentally have something connected wrong. Any help would be greatly appreciated!
-
Noob question;
I wan to use this library: https://www.npmjs.com/package/modbus-rtu
It uses a Serial library that is for node. Will that conflict with the Espurino serial? Would I just pass in an instance of the Espruino Serial connection when creating the Modbus master?
-
The SIM900 module I have actually does not have a reset pin unfortunately. Also, the SIM800 is said to have a lower power consumption. We just bought a newer SIM800 we are going to try when it comes in - we read something about the SIM800 wanting 2.8V on the RX side but the new one we bought said it has level shifting circuitry to support 2.8-5V logic. I'll come back here with my findings from the newer SIM800 when it comes in.
-
I was working with a SIM900 module and using the espruino SIM900 module. I had problems so we ended up purchasing a SIM800 module.
The SIM900 espruino code module was just hanging forever on the first simple ATE0 command. So to test I just tried to use the AT espruino code module directly to connect to the SIM800 and try to issue an AT command... hangs forever. I even tried a very long timeout of 10s to try to see if that was the problem.
What am I doing wrong here? (I also pulled the AT code locally and tried to put in some debug bug got nowhere because i never get the on data callback to fire on the serial connection.) This exact code works find if I plug it into my sim900 chip.
Serial3.setup(115200, { rx: B11, tx : B10 }); var at = require('AT').connect(Serial3); setTimeout(function(){ at.debug(); at.cmd('AT\r\n', 10000, function(r){ console.log(r); }); }, 10000);
-
Just for some additional info: I have the module connected as described here: http://www.espruino.com/SIM900. Also I am using that sample code as well with some small changes like using 9600 baud vs the 115200 since the wiki page for the pi module says its 9600.
-
@Gordon - The undefined doesn't seem to be an error condition though. If I increase the timeouts or just return the cb in the SIM900 module so that it takes another round it works. Also, I am giving the module 15 seconds before attempting the initial Serial connection. As for power, this board uses 5V (I have it connected to VBAT with a 5V DC power). It has a continuous draw of 500ma with a 2A spike.
What would be a safe way to proceed? If I increase the timeouts in the SIM900 for the init calls.. is that 'safe' as in reliable or is there something deeper wrong here that I need to wait for resolution on?
This is the board I am testing with: http://wiki.iteadstudio.com/RPI_SIM900_GSM/GPRS_ADD-ON_V1.0
This wont be our final board as this was just an extra sim900 we had around and are having to plug into the pi connector to get back over to our espruino which is fine for our testing.
-
I think the issue is actually in the AT module. Something is broken with its timeout logic. When I increase the timeout to 10s for each AT command in the SIM900 modules init function, it works. Going to dig in more on the AT module to see if I can see why it is passing undefined back to its callback.
-
This is the output when I run it as it is where the step 1 AT command has a 100ms timeout. Notice how we get the 'undefined' in that step now.
Connecting to SIM900 module
] "ÿ" <--- "ÿ"
DEBUG: Starting
["ATE0\r\n"
] "ÿA" <--- "A"
] "ÿATE0" <--- "TE0"
] "ÿATE0\r\n\r\n" <--- "\r\n\r\n"
DEBUG:ÿATE0
] "OK\r\n" <--- "OK\r\n"
DEBUG:OK
["AT+CPIN?\r\n"
DEBUG:undefined
] "\r" <--- "\r"
] "\n+CP" <--- "\n+CP"
] "+CPIN: " <--- "IN: "
] "+CPIN: READ" <--- "READ"
] "+CPIN: READY\r\n\r" <--- "Y\r\n\r"
] "\nOK\r\n" <--- "\nOK\r\n" -
Ok I def need some help. In debugging this I am getting what seems like weird behavior and I can't identify why.
The SIM900 module issues AT commands with a 100ms timeout which is fine because it passes itself as a function and does a stepper pattern where it just keeps checking the response from the AT command and once it gets a good response it steps to the next command etc.
However, what I am seeing is that the SIM900 module does not account for getting 'undefined' back as a result from the AT callback. I am trying to step through that code as well to figure out what is going on. If I make the timeout larger (like 2000ms) for step 1 it will get a good response and move on to step 2. This of course is not ideal ... the current code should work because it just continues to call itself on the same step until it gets one of N number of results.
Here is the output of a session where the step 1 (AT+CPIN?\r\n) was set to a 2000ms timeout on the AT call. If I leave it at the 100ms timeout, I will get an undefined in that step... Really could use some help on this one!
Connecting to SIM900 module
] "ÿ" <--- "ÿ"
] "ÿÿ" <--- "ÿ"
] "ÿÿÿ" <--- "ÿ"
DEBUG: Starting
["ATE0\r\n"
] "ÿÿÿA" <--- "A"
] "ÿÿÿATE0" <--- "TE0"
] "ÿÿÿATE0\r\n\r\n" <--- "\r\n\r\n"
DEBUG:ÿÿÿATE0
] "OK\r\n" <--- "OK\r\n"
DEBUG:OK
["AT+CPIN?\rr\n"
] "\r" <--- "\r"
] "\n+CP" <--- "\n+CP"
] "+CPIN: " <--- "IN: "
] "+CPIN: READ" <--- "READ"
] "+CPIN: READY\r\n\r" <--- "Y\r\n\r"
DEBUG:+CPIN: READY
] "\nOK\r\n" <--- "\nOK\r\n"
DEBUG:OK
["AT+CGATT?\r\n"
DEBUG:undefined
] "\r" <--- "\r"
] "\n+CG" <--- "\n+CG"
] "+CGATT:" <--- "ATT:"
] "+CGATT: 0\r\n" <--- " 0\r\n"
] "\r\nOK\r\n" <--- "\r\nOK\r\n" -
-
-
I need some help. I am trying to use the SIM900 right now with a neo aeris sim card. I was able to run the sample after a few tries and actually got the "Hello World" printed from the GET but now I keep getting errors.
Connecting to SIM900 module
Error in 0: ÿÿÿATE0
] "\nOK\r\n" <--- "\nOK\r\n"What is weird is I am reading that I got "\nOK\r\n" back from the SIM900 modue in the init method... at least that is how i read it. But it looks like the code just compares against "OK" and I see that pattern alot where it compares against what appears to be a cleansed string.
Anybody got any pointers?
-
NVM: I found this: http://www.espruino.com/Writing+Modules
I got frustrated so I unplugged everything from the espruino and rewired it all and ran it again and it worked fine.. so my guess is I just had a bad connection on pin 4 of the maxbotix.