8 Replies Latest reply on Aug 26, 2019 4:48 AM by blacktronics

    Using GPIO2 Baremetal

    blacktronics

      So i have been playing around with the Kit a little and i find it quite difficult to find any documentation whatsoever.

       

      I pulled the GPIO sample application from

      https://github.com/Azure/azure-sphere-samples/tree/master/Samples/GPIO/GPIO_RTApp_MT3620_BareMetal

       

      Changing the GPIO pin from 8 to 9 or 10 drives the expected LED, however, changing this to pin 2 does nothing.

       

      I assume it is on a different GPIO block but i am not sure and can't really find anything.

      What am i missing here?

       

      I have been considering to replace an STM32 in a current project with the MT3620 but so far, using this thing just feels incredibly messy and cumbersome.

      Tons of sample code that is practically uncommented and unexplained definitions everywhere for which you gotta dig through the references because there is no info of what is going on.

       

      What i am currently trying to do as a getting into it project is drive some servos (pulse/direction) based on gyro data

        • Re: Using GPIO2 Baremetal
          clem57

          You have to change the application manifest as well. This is the XML that allows your application to use which GPIO pins. Otherwise you get a bad return code if not.

          blacktronics let me know if this helps or not...

          1 of 1 people found this helpful
          • Re: Using GPIO2 Baremetal
            bwilless

            Blacktronics,

             

            I have not used that example application, but I know that if you post your question on the GitHub project page, the Microsoft engineers will respond to your question. 

             

            Brian

            1 of 1 people found this helpful
            • Re: Using GPIO2 Baremetal
              javagoza

              What do you expect changing to GPIO 2? GPIO 2 isn't connected to anything in the kit. If you want to play with the leds:

              See the User Guide:

               

              Azure Sphere Starter Kit User Guide (v1.5)

              Azure Sphere - Tips to max-out your Starter Kit hardware! (Part 1)

               

              1 of 1 people found this helpful
                • Re: Using GPIO2 Baremetal
                  blacktronics

                  I'd expect GPIO2_PWM, which is exposed on the pin headers, to output a TTL signal, which it doesn't.

                   

                  People with soldering irons and oscilloscopes exist.

                  1 of 1 people found this helpful
                    • Re: Using GPIO2 Baremetal
                      javagoza

                      Sorry for the misunderstanding.

                       

                      As you had already pointed GPIO2 is in another block, so you have to add the block first, but I think that block base addresses are not public at this moment. Maybe you can try to figure which address is from this part of the code:

                       

                          // Block includes led1RedGpio, GPIO8.
                          static const GpioBlock pwm2 = {
                              .baseAddr = 0x38030000, .type = GpioBlock_PWM, .firstPin = 8, .pinCount = 4};
                      
                          Mt3620_Gpio_AddBlock(&pwm2);
                      
                          // Block includes buttonAGpio, GPIO12
                          static const GpioBlock grp3 = {
                              .baseAddr = 0x38040000, .type = GpioBlock_GRP, .firstPin = 12, .pinCount = 4};
                      
                          Mt3620_Gpio_AddBlock(&grp3);
                      

                       

                      /// <summary>
                      /// The MT3620 board supports multiple GPIO block types. These blocks
                      /// have slightly different register layouts, so the GPIO software needs
                      /// to know what kind of block a given pin is in.
                      /// </summary>
                      typedef enum {
                          /// <summary>GPIO pins are multiplexed with an ADC block.</summary>
                          GpioBlock_ADC = 0,
                          /// <summary>GPIO block also supports PWM.</summary>
                          GpioBlock_PWM = 1,
                          /// <summary>A plain GPIO block.</summary>
                          GpioBlock_GRP = 2,
                          /// <summary>GPIO pins are multiplexed with I2C / SPI / UART.</summary>
                          GpioBlock_ISU = 3,
                          /// <summary>GPIO pins are multiplexed with I2S block.</summary>
                          GpioBlock_I2S = 4
                      } GpioBlockType;
                      

                       

                      I also had the same problem, I'm using GPIO2 and GPIO1 in order to signal MRDY and SRDY in a SNP connection with a BLE TI cc2650SOMA module and I have had to make my driver in the high level app environment, until Mediatek frees some more info.

                      2 of 2 people found this helpful