Sony's Developer World forum

    • Home
    • Forum guidelines

    Upcoming maintenance 

     

    Dear Customers and Partners.

    This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.

    This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.

    We apologize for any inconvenience.

     

     

    Unsolved Is it possible to communicate between the subcores only?

    Spresense
    3
    6
    1177
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      NavaneethRao 2 last edited by

      I am trying to send a random data from subcore 2 to subcore 1. Main core is only booting up the cores. But I receive a core dump when I tried doing this.
      Below is the code:

      #include <MP.h>

      #if (!SUBCORE)

      void setup() {
      // put your setup code here, to run once:

      Serial.begin(115200);

      /* Boot SubCores */
      for (int subid = 1; subid <= 2; subid++) {
      int ret = MP.begin(subid);
      if (ret < 0) {
      MPLog("MP.begin(%d) error = %d\n", subid, ret);
      }
      }
      }

      void loop() {
      }

      #endif

      #if (SUBCORE == 2)

      void setup() {
      // put your setup code here, to run once:
      MP.begin();
      }

      void loop() {
      // put your main code here, to run repeatedly:
      uint8_t sub2ID = 200;
      int ret;
      uint32_t msgdata;

      msgdata = random(32767);

      ret = MP.Send(sub2ID,msgdata,1);

      if (ret < 0) {
      MPLog("MP.Send error = %d\n", ret);
      }

      MP.RecvTimeout(MP_RECV_BLOCKING);

      delay(1000);
      }

      #endif

      #if (SUBCORE == 1)

      void setup() {
      // put your setup code here, to run once:
      int ret = 0;

      ret = MP.begin();
      if (ret < 0) {
      MPLog("MP.begin error = %d\n",ret);
      }
      }

      void loop() {
      // put your main code here, to run repeatedly:
      int ret;
      int8_t msgid;
      uint32_t msgdata;

      ret = MP.Recv(&msgid, &msgdata,2);

      if(ret < 0){
      printf("MP.Receive error = %d\n", ret);
      }

      MPLog("Received data : %lx\n", msgdata);
      }
      #endif

      Any help would be greatly appreciated.

      Thanks in advance.
      Navaneeth

      C 1 Reply Last reply Reply Quote
      • C
        CamilaSouza DeveloperWorld @NavaneethRao 2 last edited by

        Hey, @NavaneethRao-2

        Yes, it is possible to communicate between the subcores.

        1. Have you tried one of the arduino MP examples? Did they work for you?
        2. Have you tried reducing the memory allocated for the main core so you have more space in the subcores?
        3. Have you tried to but a little bit of a delay in the main core loop (like 1s)?
        N 1 Reply Last reply Reply Quote
        • N
          NavaneethRao 2 @CamilaSouza last edited by

          @CamilaSouza Yes I have tried the examples. Everything have worked fine. Since I am sending a very small data I didn't change the memory layout of the cores.

          I tried to do a bit different than the examples. Just trying to send some random data from subcore 2 to subcore 1 while main core boots up the subcores.

          I have few questions.

          1. I have an MP.Send in the subcore 2 code. Should I add delay there?
          2. Also MP.ReceiveTimeout() API is called in maincore loop. Should it be present in subcore 2?

          Is there a go to guide or a troubleshooting info for working with multicores?

          BR
          Navaneeth S Rao

          J C 2 Replies Last reply Reply Quote
          • J
            jens6151 0 1 1 @NavaneethRao 2 last edited by

            @NavaneethRao-2
            I received core dumps when I tried to send (repeated?) data to a core that was not listening. Can you double check if you have the core always listening especially when you use threads/tasks in what you tried.

            However I stoped using ASMP recently, so sorry I have no solution.

            1 Reply Last reply Reply Quote
            • C
              CamilaSouza DeveloperWorld @NavaneethRao 2 last edited by

              Hi, @NavaneethRao-2

              Sorry for the delayed response.
              I don't know if you're still interested in this topic, but I took a look at your code and found a fix.

              I simply replaced your message id it for 10 instead of 200 and the code worked.
              Maybe it was too big before.

              BEFORE:

              uint8_t sub2ID = 200;
              

              AFTER:

              uint8_t sub2ID = 10;
              
              N 1 Reply Last reply Reply Quote
              • N
                NavaneethRao 2 @CamilaSouza last edited by

                @CamilaSouza Thank you for your prompt response. Yeah, it worked.

                1 Reply Last reply Reply Quote
                • First post
                  Last post
                Developer World
                Copyright © 2021 Sony Group Corporation. All rights reserved.
                • Contact us
                • Legal