4 Replies Latest reply on Nov 19, 2020 12:01 AM by LUAB_4724786

    Understanding PUART on CYBT-213043-Mesh Kit

    LUAB_4724786

      Hi there,

       

      I've been using PUART so far in this kit to check the debug log and right now want to understand and utilize PUART to communicate with other peripheral or another mcu perhaps. Right now I cannot find example in the mesh sample code about this PUART related but so far below that I can gather and some questions about it. I also downloaded example from another kit HAL-213043-EVAL since it is using the same chip I believe, in there is an example for PUART.

       

      1. Can I compile (sample from HAL-213043-EVAL) from eclipse IDE modus tool box and loading it using ChipLoad to CYBT-213043-02 EZ-BT Module (since in the mesh kit PUART pin is not expose) ?
      2. The structure in the example is a bit different with mesh sample structure, no APPLICATION_START() in mesh sample structure, how to implement it on mesh ? should I declare it under mesh_app_init() ?
      3. I recognize that debuging log using puart as well, should I reroute the debuging log to HCI if I am going to use PUART ?
      4. I also checked that PUART (RX/TX) pins is defined in mesh,  can I just use that pin ?
      5. What is the proper way/steps to use PUART in mesh kit ?

       

      Thanks in advance.

       

      Best Regards,

      LUTHFI AD

        • 1. Re: Understanding PUART on CYBT-213043-Mesh Kit
          DheerajP_41

          Hi,

           

          I believe, you are asking about the below given example. Correct me if I am wrong.

          mtb-examples-CYBT-213043-EVAL-btsdk-hal/hal/puart at master · cypresssemiconductorco/mtb-examples-CYBT-213043-EVAL-btsdk…

           

          5. I would like to answer the last question first.

          As you know, puart is used mainly for debugging logs in mesh. In mesh applications, we suggest you to use HCI control protocol over HCI uart to communicate with the host device due to many reasons such as bigger hardware buffers, flow control, firmware support (E.g. mesh_app_proc_rx_cmd()), etc. You can always integrate PUART with any BTSDK applications using wiced_hal_puart_* APIs and use.

           

          The question here is, why do you want to use PUART to communicate with host, and route the debug logs to HCI uart, which is not recommended.

           

          1. Since both have same module, the download should work without any problem. But due to the platform difference, the functionality can get affected. We have tested only the mesh applications (which are listed on project creator tool) on CYBT-213043-MESH kit, because it is built specifically for evaluations of Mesh application.

           

          2. Current PUART configurations are done in mesh_app_hci.c. Please have a look.

          You have to take care of it when you change anything related to PUART in mesh applications.

           

          3. yes. You can reroute the debug logs to HCI uart.

           

          4. Question is not clear.

          If you are talking about the pins defined in the firmware, - yes. you can use the same pins.

           

          Thanks,

          -Dheeraj

          • 2. Re: Understanding PUART on CYBT-213043-Mesh Kit
            LUAB_4724786

            Hi Dheeraj,

             

            The question here is, why do you want to use PUART to communicate with host, and route the debug logs to HCI uart, which is not recommended.

            The reason is because of the purpose and it is actually the host is a simple MCU and dont want to implement HCI Control Protocol, just simple communication protocol in there.

            The reason to route the debug route is because in the beginning I thought "if I can use PUART" ... I dont want any other msg in PUART communication beside my message, so need to "silent" the debug log ... right ? (or not ?) anyway, if I can completely undef all debug log will do as well, no need to route the debug log, is it possible ? turn it all off ?

             

            Since both have same module, the download should work without any problem. But due to the platform difference, the functionality can get affected. We have tested only the mesh applications (which are listed on project creator tool) on CYBT-213043-MESH kit, because it is built specifically for evaluations of Mesh application.

            Yes ... noted, actually I will download it to EZ Module and test it without mesh kit, just the example from here as an experiment.

             

            2. Current PUART configurations are done in mesh_app_hci.c. Please have a look.

            You have to take care of it when you change anything related to PUART in mesh applications.

            Actually I did check in there, but most of it about HCI in there no puart related function like wiced_hal_puart_configuration(), wiced_hal_puart_register_interrupt(), etc ... It seems all of them being configured already when it is being used for debug log somewhere else for mesh, anyway ... will double check.

             

            4. Question is not clear.

            If you are talking about the pins defined in the firmware, - yes. you can use the same pins.

            yes, I am talking about those defined in firmware (wiced_platform.h).

            Screenshot (21).png

             

            Thanks for the help, actually I am starting this question because some of the PUART related function is involving registering puart interrupt and event resetting puart interrupt (thats what I saw in the sample CYBT-213043-EVAL) ... and it got me thinking if I try something on puart it will affect the debugging log also, since it is using puart.

             

            I will do some experiment with PUART since it doesnt required any protocol and if it is too much then no choice need to implement HCI Protocol at host.

             

            Best Regards,

            LUTHFI AD

             

            • 3. Re: Understanding PUART on CYBT-213043-Mesh Kit
              DheerajP_41

              Hi,

               

              1. Yes. You can use wiced_set_debug_uart(WICED_ROUTE_DEBUG_NONE) API to turn off the device debug traces, if you want.

               

              2.  I believe, DWICED_BT_TRACE_ENABLE macro will initialize the puart internally for the debug traces. So no need to reinitialize.

              And, It will be only used for debug traces. If you need receive raw data, you need to integrate the PUART code as well with mesh application.

               

              4. Yes. You can use those pins. Please refer the datasheet as well for more info about the pins and functionality.

               

              You may need to turn off PUART debug traces when you communicate with a MCU over PUART by exchanging valid data.

              Please find the sample PUART application here: mtb-examples-CYBT-213043-EVAL-btsdk-hal/hal/puart at master · cypresssemiconductorco/mtb-examples-CYBT-213043-EVAL-btsdk…

               

              Thanks,

              -Dheeraj

              • 4. Re: Understanding PUART on CYBT-213043-Mesh Kit
                LUAB_4724786

                Dear Dheeraj,

                 

                Many thanks for the support, will do with the recommendation.

                 

                Best Regards,

                LUTHFI AD