increase and know the max data possible to send

Hello, i'm using the example ble app uart and I would like to know the maximum data that I cand send to my putty and my phone. Could I have to procedure? I would like to send a lot of data 

Thank you in advance

  • no problem :) yes but i only issue is to create the fragments actually I saw this function that could help in the main.c but I don't know where to put it.

    static void send_long_buffer(uint8_t *buf, uint16_t buf_length)
    {
        uint32_t err_code;
        uint16_t length;
        uint32_t offset = 0;
        uint32_t max_payload_size = 244;
    
        // Exécutez cette boucle jusqu'à ce que le buffer entier soit transmis avec succès
    
        while(buf_length > 0)
        {
            //Envoyer un segment/paquet du buffer total
            do
            {
                length = (buf_length > max_payload_size) ? max_payload_size : buf_length;
                err_code = ble_nus_data_send(&m_nus, buf + offset, &length, m_conn_handle);
                if ((err_code != NRF_ERROR_INVALID_STATE) &&
                    (err_code != NRF_ERROR_RESOURCES) &&
                    (err_code != NRF_ERROR_NOT_FOUND))
                {
                    APP_ERROR_CHECK(err_code);
                }
            } while (err_code == NRF_ERROR_RESOURCES);
    
            //Pour chaque téléchargement de paquet réussi, augmentez le décalage du buffer et réduisez la longueur de buffer restant
    
            offset += length;
            buf_length -= length;
        }
    }
    

  • I don't where to use this function or to call it thank you in advance

  • And the 244 bytes can be transmitted but we have 245 bytes we have an error and nothing is transmitted.

  • lm said:
    yes but i only issue is to create the fragments actually I saw this function that could help in the main.c but I don't know where to put it.

    Yes, but this is still all on the peripheral side - which is working as expected.
    The function you shared is a peripheral side function, which will not affect how you are able to send things from the phone to the peripheral.
    The changes you will need to make is on the central(phone) side, so that you are able to queue your large dataframe for transfer, or perhaps I am misunderstanding you again?

    lm said:
    And the 244 bytes can be transmitted but we have 245 bytes we have an error and nothing is transmitted.

    True, this is as expected - when an error is returned it means that the function call as a whole failed, in which case nothing will be transmitted and you will have to re-do the function call.

    Best regards,
    Karl

  • Okay, maybe we don't understand each other but my problem is : 

    - from PHONE to my COMPUTER :

     data is not transmitted at 245 bytes and I have a gatt error. My goal is to create a function as I show you to fragment the code and send 2 notifications to my computer. 

    I would like to know what I have to modify on the ble app uart code to create directly those fragments of 244 bytes each.

    but from COMPUTER to PHONE I don't have any problems :)

Related