3 Replies Latest reply on May 16, 2016 4:14 PM by PabloM_Intel

    Jtag, reading inputs and avoiding bricking

    DonAlan

      Looking at BSP 1.0 in the rom code it seems that it checks for GPIO13 to be high before continuing.

      This is to prevent Jtag interface being changed to some other function before the processor can be stopped by Jtag.

      from rom_startup.c

      /*

      * Gpio pin assigned for JTAG sensing.

      * On the Quark D2000 Development Platform this is the IO0 pin.

      */

      #define WAIT_FOR_JTAG_PIN (13)

       

      The doco says it should be checking pin 13 rather than GPIO 13.

       

      But in any case it makes most sense to check the GPIO pins that are associated with the Jtag interface.

       

      If these pins are set as Jtag function can their state still be read with GPIO_EXT_PORTA?

        • 1. Re: Jtag, reading inputs and avoiding bricking
          PabloM_Intel

          Hi DonAlan,

           

          Yes, it should be interpreted as GPIO13 rather than just pin 13, also because it mentions IO0 in the rom_startup.c file. However, I’m not sure if you’re referring to the same document (rom_startup.c) when you say this “The doco says it should be checking pin 13 rather than GPIO 13”, is this the case? Please let me know if you’re talking about a different document.

          Regarding your second question, there shouldn’t be any issue trying to read the port with GPIO_EXT_PORTA as you’re only querying the GPIO pins state.

           

          Regards,

          Pablo

          • 2. Re: Jtag, reading inputs and avoiding bricking
            DonAlan

            PabloM_Intel

             

            I refer to

             

            Limitations and Known Issues in Intel System Studio 2016 for Microcontroller

            Posted by Vick1234 in Intel(r) Quark(tm) Microcontrollers on Apr 6, 2016 4:37:00 AM

             

            where it says

            To recover your board, the BSP-ROM can help - simply set IO0 pin to GND (Arduino RX or SoC pin13)

             

            but in the hello world project bsp\soc\quark_d2000\rom\rom_startup.c it has

            --

            /*

            * Gpio pin assigned for JTAG sensing.

            * On the Quark D2000 Development Platform this is the IO0 pin.

            */

            #define WAIT_FOR_JTAG_PIN (13)

            --

            qm_pmux_pullup_en(WAIT_FOR_JTAG_PIN, true);

                qm_pmux_select(WAIT_FOR_JTAG_PIN, QM_PMUX_FN_0);

                qm_pmux_input_en(WAIT_FOR_JTAG_PIN, true);

            clk_periph_enable(CLK_PERIPH_REGISTER | CLK_PERIPH_CLK |
                  CLK_PERIPH_GPIO_REGISTER);

             

                while (false == qm_gpio_read_pin(QM_GPIO_0, WAIT_FOR_JTAG_PIN)) {

               /* Busy loop to allow JTAG access */

                }

             

                /* Restore hardware default settings */

                clk_periph_disable(CLK_PERIPH_CLK);

                qm_pmux_pullup_en(WAIT_FOR_JTAG_PIN, false);

             

            --

             

            Reading through the qm_gpio_read_pin it seems this should refer to a GPIO13.  The reason it is an issue for me is that there is an inconsistency between 1 or more of Doco, my understanding, the code (is there an updated rom_startup.c?).

            • 3. Re: Jtag, reading inputs and avoiding bricking
              PabloM_Intel

              Hi Don Alan,

               

              I apologize, I think I got confused too by the wording of the documents. I’ll try to cover every possible scenario. For the following text:

               

              “GPIO pin assigned for JTAG sensing. On the Quark D2000 Development Platform this is the IO0 pin”.

              IO0 refers to the pin numbering of the Arduino shield. You can check that in the image below.

               

              Capture.PNG

               

              Now, regarding the question about pin 13, GPIO 13 or SoC 13 (you might already have this clear, but I just want to make sure that we are on the same page), you can see the following in the Intel Quark Microcontroller BSP documentation:

               

              Bool qm_gpio_read_pin ( const qm_gpio_t gpio, const uint8_t pin ) – Read the current value of a single pin on a given GPIO port.

              Parameters:

              • [in] gpio GPIO port index.
              • [in] pin Pin of GPIO port to read.

              Returns:

              • Bool Value of the pin specified on GPIO port.

               

              Now, this is indeed referring to GPIO 13 (which can also be concluded if we use IO0 as reference). In this case, in terms of SoC pins, the equivalent SoC pin would be 5 and not 13. However, as you said, it would be more logical if the pin used is related to the JTAG interface. We are now investigating this and will get back to you as soon as we have an answer.

               

              Regards,

              Pablo