Git Product home page Git Product logo

Comments (9)

RobMeades avatar RobMeades commented on August 21, 2024

HI Alex. The command sequence looks fine, seems to just be getting no MQTT broker connection within the time given.

For your module type (SARA-R412M-02B-01 I believe) uMqttConnect() (the AT+UMQTTC=1 in the log) allows 15 seconds for the broker connection (see here). You could maybe try increasing that value 60000, as an experiment, to see if it just needs longer for some reason?

from ubxlib.

RobMeades avatar RobMeades commented on August 21, 2024

Hi @alexmaron81: how did this go in the end?

from ubxlib.

alexmaron81 avatar alexmaron81 commented on August 21, 2024

Hi Rob, I haven't been able to test any further yet. I was on holiday last week. Friday I have another meeting with thailand.

from ubxlib.

alexmaron81 avatar alexmaron81 commented on August 21, 2024

Can i ping an ip address?

from ubxlib.

RobMeades avatar RobMeades commented on August 21, 2024

The cellular module does support a command called AT+UPING but it is not something we have so far been asked to implement in ubxlib. If you wanted to add it yourself you could paste something like this into the end of u_cell_net.c:

int32_t uCellNetPing(uDeviceHandle_t cellHandle, const char *pDestination)
{
    int32_t errorCode = (int32_t) U_ERROR_COMMON_INVALID_PARAMETER;
    uCellPrivateInstance_t *pInstance;
    uAtClientHandle_t atHandle;

    if (gUCellPrivateMutex != NULL) {

        U_PORT_MUTEX_LOCK(gUCellPrivateMutex);

        pInstance = pUCellPrivateGetInstance(cellHandle);
        if ((pInstance != NULL) && (pDestination != NULL)) {
            atHandle = pInstance->atHandle;

            uAtClientLock(atHandle);
            uAtClientCommandStart(atHandle, "AT+UPING=");
            // Write destination
            uAtClientWriteString(atHandle, pDestination, true);
            uAtClientCommandStopReadResponse(atHandle);
            errorCode = uAtClientUnlock(atHandle);
        }

        U_PORT_MUTEX_UNLOCK(gUCellPrivateMutex);
    }

    return errorCode;
}

...adding a header for it as follows in u_cell_net.h:

/** Ping an address.
 *
 * @param cellHandle       the handle of the cellular instance.
 * @param[in] pDestination the destination IP address or domain; cannot be NULL.
 * @return                 zero on success or negative error code on
 *                         failure.
 */
int32_t uCellNetPing(uDeviceHandle_t cellHandle, const char *pDestination);

from ubxlib.

alexmaron81 avatar alexmaron81 commented on August 21, 2024

Hi Rob, I'm getting an error

AT+UPING="10.65.66.157"

ERROR
CONNECT-BoxAT+UMQTT=3,"10.65.66.157"

is it true what is written in the following link?

https://portal.u-blox.com/s/question/0D52p00008qiQNOCA2/sarar41002b-with-ublox-nbiot-module-atuping-gives-error-even-though-device-is-attached-and-udp-data-transfer-works

from ubxlib.

RobMeades avatar RobMeades commented on August 21, 2024

Gah, yes, re-checking the SARA-R4 AT manual:

image

Sorry, no ping on SARA-R412M.

from ubxlib.

alexmaron81 avatar alexmaron81 commented on August 21, 2024

can i do it in a different way?

from ubxlib.

RobMeades avatar RobMeades commented on August 21, 2024

Not that I can think of I'm afraid. In theory you could connect at PPP-level and use the native ESP-IDF IP stack to do the ping but we have never tried making a PPP connection on a SARA-R412 and it would be a major change to the way your SW works to build and use PPP.

If what you would like to do is to check connectivity with a specific server or servers, what I would do is run a UDP echo client on a known/open port of that server, then you could send UDP packets to that server on that port and check for the echoed response coming back. Of course you would need access to the server-side to do this. Mind you, you might need access to the server-side in any case to be sure that it is configured to respond to ping.

Alternatively, beneath the MQTT protocol which I guess you are trying to test lies TCP, so if you opened a TCP connection on whatever your MQTT port is and that connection was successfully opened at TCP level then you have proved that there is connectivity, assuming that is your aim, you don't need to do any MQTT stuff at all. So you could just follow the pattern of the TLS sockets example (assuming you have TLS security) or otherwise the sockets example (if you don't have TLS security) to the IP address and port number of your MQTT broker.

But that is, of course, a more complicated arrangement than a UDP echo arrangement or ping.

from ubxlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.