Freertos based application is taking too long to get started












0















I have a FreeRTOS application which
opens a UDP socket and transmit packets and receive response.I have used socket.c and W5100.c iomedia library files to build this application with WHiznet EThernet shield. Now When i put a task delay between startup and UDP socket transmitting first packet my application works fine, But if i remove this task delay then no packet is received at Server end. However sendto still returns correct length of packet transmitted.Can somebody please suggest some way how i can debug the application.



void vTaskCode( void * pvParameters )
{
/* The parameter value is expected to be 1 as 1 is passed in the
pvParameters value in the call to xTaskCreate() below.*/
configASSERT( ( ( uint32_t ) pvParameters ) == 1 );
vTaskDelay(20000/portTICK_PERIOD_MS); ***// If I remove this delay packet will never reach other machine.***
socket(DHCP_SOCKET, Sn_MR_UDP, DHCP_CLIENT_PORT, 0x00);
**// create the DHCP message here.**
sendto(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
}









share|improve this question





























    0















    I have a FreeRTOS application which
    opens a UDP socket and transmit packets and receive response.I have used socket.c and W5100.c iomedia library files to build this application with WHiznet EThernet shield. Now When i put a task delay between startup and UDP socket transmitting first packet my application works fine, But if i remove this task delay then no packet is received at Server end. However sendto still returns correct length of packet transmitted.Can somebody please suggest some way how i can debug the application.



    void vTaskCode( void * pvParameters )
    {
    /* The parameter value is expected to be 1 as 1 is passed in the
    pvParameters value in the call to xTaskCreate() below.*/
    configASSERT( ( ( uint32_t ) pvParameters ) == 1 );
    vTaskDelay(20000/portTICK_PERIOD_MS); ***// If I remove this delay packet will never reach other machine.***
    socket(DHCP_SOCKET, Sn_MR_UDP, DHCP_CLIENT_PORT, 0x00);
    **// create the DHCP message here.**
    sendto(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
    }









    share|improve this question



























      0












      0








      0








      I have a FreeRTOS application which
      opens a UDP socket and transmit packets and receive response.I have used socket.c and W5100.c iomedia library files to build this application with WHiznet EThernet shield. Now When i put a task delay between startup and UDP socket transmitting first packet my application works fine, But if i remove this task delay then no packet is received at Server end. However sendto still returns correct length of packet transmitted.Can somebody please suggest some way how i can debug the application.



      void vTaskCode( void * pvParameters )
      {
      /* The parameter value is expected to be 1 as 1 is passed in the
      pvParameters value in the call to xTaskCreate() below.*/
      configASSERT( ( ( uint32_t ) pvParameters ) == 1 );
      vTaskDelay(20000/portTICK_PERIOD_MS); ***// If I remove this delay packet will never reach other machine.***
      socket(DHCP_SOCKET, Sn_MR_UDP, DHCP_CLIENT_PORT, 0x00);
      **// create the DHCP message here.**
      sendto(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
      }









      share|improve this question
















      I have a FreeRTOS application which
      opens a UDP socket and transmit packets and receive response.I have used socket.c and W5100.c iomedia library files to build this application with WHiznet EThernet shield. Now When i put a task delay between startup and UDP socket transmitting first packet my application works fine, But if i remove this task delay then no packet is received at Server end. However sendto still returns correct length of packet transmitted.Can somebody please suggest some way how i can debug the application.



      void vTaskCode( void * pvParameters )
      {
      /* The parameter value is expected to be 1 as 1 is passed in the
      pvParameters value in the call to xTaskCreate() below.*/
      configASSERT( ( ( uint32_t ) pvParameters ) == 1 );
      vTaskDelay(20000/portTICK_PERIOD_MS); ***// If I remove this delay packet will never reach other machine.***
      socket(DHCP_SOCKET, Sn_MR_UDP, DHCP_CLIENT_PORT, 0x00);
      **// create the DHCP message here.**
      sendto(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
      }






      freertos nucleo






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 '18 at 4:52







      proudengineer

















      asked Nov 26 '18 at 3:55









      proudengineerproudengineer

      589




      589
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I think first of all you need 2 different tasks for transmiting and receiving.
          Sometimes delay is neccessary for tasks synchronzation.



          Could you share a part of code?






          share|improve this answer
























          • Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

            – proudengineer
            Nov 29 '18 at 4:48











          • Added the code snippet.

            – proudengineer
            Nov 29 '18 at 4:52











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53474593%2ffreertos-based-application-is-taking-too-long-to-get-started%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I think first of all you need 2 different tasks for transmiting and receiving.
          Sometimes delay is neccessary for tasks synchronzation.



          Could you share a part of code?






          share|improve this answer
























          • Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

            – proudengineer
            Nov 29 '18 at 4:48











          • Added the code snippet.

            – proudengineer
            Nov 29 '18 at 4:52
















          0














          I think first of all you need 2 different tasks for transmiting and receiving.
          Sometimes delay is neccessary for tasks synchronzation.



          Could you share a part of code?






          share|improve this answer
























          • Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

            – proudengineer
            Nov 29 '18 at 4:48











          • Added the code snippet.

            – proudengineer
            Nov 29 '18 at 4:52














          0












          0








          0







          I think first of all you need 2 different tasks for transmiting and receiving.
          Sometimes delay is neccessary for tasks synchronzation.



          Could you share a part of code?






          share|improve this answer













          I think first of all you need 2 different tasks for transmiting and receiving.
          Sometimes delay is neccessary for tasks synchronzation.



          Could you share a part of code?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 27 '18 at 15:43









          SG92SG92

          416




          416













          • Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

            – proudengineer
            Nov 29 '18 at 4:48











          • Added the code snippet.

            – proudengineer
            Nov 29 '18 at 4:52



















          • Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

            – proudengineer
            Nov 29 '18 at 4:48











          • Added the code snippet.

            – proudengineer
            Nov 29 '18 at 4:52

















          Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

          – proudengineer
          Nov 29 '18 at 4:48





          Well The problem is not with rx side as once 1st packet is successfully transmitted , than flow works fine and i can send any number of packets after this. But I have to introduce a 20 seconds delay after application init and before transmitting else my socket won't transmit packet eventhough sendto doesn't returns error.

          – proudengineer
          Nov 29 '18 at 4:48













          Added the code snippet.

          – proudengineer
          Nov 29 '18 at 4:52





          Added the code snippet.

          – proudengineer
          Nov 29 '18 at 4:52




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53474593%2ffreertos-based-application-is-taking-too-long-to-get-started%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin