This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

advertise the data directly from DMA

I am in a project where I need to deploy a applicationas shown below.

     switch(statecase)
      {
        case 0: Scanning();      //  GAPCentralRole_StartDiscovery is called and waiting for advertiments
                                                 // once it finds advertisment data in GAP_DEVICE_INFO_EVENT:,advertisment is sent
                                                 //through Uart and go to next state.
                         break;                     
          
    case 1: if(ReadtheBuffer())    // In  GAPROLE_ADVERTISING: the RxBuffer is read,the DMA destination is directly

                                                //trasnferred to the Rxbuffer,once this buffer has data then start advertising go nextstate

                    break;

  case 2: rtrnvalue=ReadtheBuffer();    
                   if(rtrnvalue==TRUE)
                   {
                     Advertise();
                   }
                   else
                   {
                    statecase=2;
                   }

                     break;

the advertisment is not continous in any of the state its restricted to 1sec, after the time expires an event is called which will go to advertising or scanning depending on condition   

In case 1  the data from Uart is load at the start,so till case 1, it works perfectly but in case 2 the Uart is loaded after 10 seconds , after 10 seconds the control should go to case2 and start advertise there is no advertising even after 15 seconds.

Is it the problem that Cpu is continously in the switch case and is not able to detect DMA call ?

or is there some other problem.. any kind of help is appreciable.  

BR,

Timber                                             

  • Hello. I think we need some more information here.

    Have you verified that you are getting to state 2? 

    If so, are you able to read UART data?

    If so, what is the return value from the "Advertise" function call? Also, what is this function?

  • Hello,

    If I debug then the control will go inside the case 2 and then it will call the statecase2 and in next call to case2 the Advertise() function is called.

    In advertise() function,the Uart data which was from DMA is checked and advertised.

    In case 1 also the advertise function is called,sorry i missed it in previous post.

     switch(statecase)
          {
            case 0: Scanning();      
                             break;                     
              
        case 1: if(ReadtheBuffer())

                         {Advertise(); }   

                        break;

      case 2: rtrnvalue=ReadtheBuffer();     
                       if(rtrnvalue==TRUE)
                       {
                         Advertise();
                       }
                       else
                       {
                        statecase=2;
                       }

                         break;

    but if I dont debug and run directlly, I will get the advertising data in case 1,it will advertise the case1 Uart data for 1 seconds(I set the advertising time to 1 seconds) and it will stop,there will no advertising data further.

    The data for Case2 comes after 10 seconds.

    BR,

    timber