Pin access on the MikroE connector

HI,

I'm new to the toolchains on FSP.

what I need to do is toogle the CS pin on the mikroE connector to High and Low. the CS pin on the on the relay click board is relay2. 

I did this for the NXP board by toggling the Port/PIN.

I'm reviewing the EK-rA2L1 on element14.com and my notes on what I have done so far to try and get this working is defined here at  Appendix C -- Pin access on the MikroE connector

Basically I read the resource material and tried to figure out How to access the The CS pin on the MickroE BUS connector in the "System Central & Ecosystem Access" section of the board..

  • I found the reference to the CS pin  in the  EK-RA2L1 v1 - User's Manual  In section 5.3.5. The Page is pictured below for reference.
  • I referred to "Table16. mickroE Connector"
    • The row for the CS pin (highlighted) the signal is on P103. This is what I used to lookup the pin in the FSP configurator Described below.
    •  created a new C/C++ project based using the Blinky Bare Metal template. as described in the FSP manual
    • Then in the FSP configuration viewer, on the "Pins Tab" I found the CS pin information displayed below. by clicking on P103
      • I did not change anything on this page I assumed it was all set.

      • I modified the hal_entry.c code as follows
        • Added - include "r_ioport.h"
        • Added - the define for led pin to BSP_IO_Port_01_Pin_03
        • I tried the following 2 module methods:
        • Used call for BSP write and it did not work
        • So I tried R_IOPORT_PinWrite(&g_ioport_ctrl, RELAY1, pin_level); and that also did not work

    I'm stuck at this point and need to answer some questions..

      • What am I missing?
      • Is there another Module I need to add?
      • Am I using the right API?
      • Ho do you reference a pin on the access area of the board?
      • Is it like the LED pin reference in Blinky?

      I started looking for other examples that refer to some pins in  the  

      Kind Regards.

      Stephen Kruglewicz

      Element14 reviewer

      Parents
      • The RA book is a good resource for new users to the RA devices and the FSP :-

        www.renesas.com/.../ra-book

        When a pin is configured as a peripheral pin :-

        then the peripheral it is connected to controls the pin (it is not a GPIO). In the case of P1_03 above, it is configured as an SPI pin, so the SPI peripheral controls the pin. The driver for the SPI peripheral is "SPI Driver on r_spi".

        There are a number of example projects available for the FSP :-

        https://github.com/renesas/ra-fsp-examples

        The r_spi example project for the EK-RA2L1 board is :-

        https://github.com/renesas/ra-fsp-examples/tree/master/example_projects/ek_ra2l1/spi/spi_ek_ra2l1_ep

        though the example spi project for the EK-RA2L1 does not use the SPI on the MikroBUS connector.

        To control the pin as a GPIO, it needs to be configured in either Input or Output mode :-

        and since by default, PFS protection is enabled in the BSP tab of the configurator :-

        you would need to use the code :-

            #define RELAY1 BSP_IO_PORT_01_PIN_03
            bsp_io_level_t pin_level = BSP_IO_LEVEL_LOW;
            
            R_BSP_PinAccessEnable();
            R_IOPORT_PinWrite(&g_ioport_ctrl, RELAY1, pin_level);
            R_BSP_PinAccessDisable();

        to toggle a GPIO that is set as an output.

      • Hello Jeremy,

        Thank you for your quick reply. 

        The reference to ra-book is appreciated. I had actually stumbled on it the other day. I'll be reading through it. 

        I tried your GPIO settings and the code is still not working. but I could not change the mode Dropdown because it only contain a Peripheral selection? So I had to disable P103 first in the pins grid, in order to set the Mode to your suggestion. then I was able to change the mode.

        I used the code as you suggested

        ---------------------------------------------------------------

        #define RELAY1  BSP_IO_PORT_01_PIN_03.

        R_BSP_PinAccessEnable();

        // Toggle Relay
        //R_BSP_PinWrite(RELAY1, pin_level);
        R_IOPORT_PinWrite(&g_ioport_ctrl, RELAY1, pin_level);

        /* Protect PFS registers */
        R_BSP_PinAccessDisable();

         _____________________

        At this point I'm assuming it's not working because GPIO is not Capable on this pin, because it is not listed in the "Port Capabilities" list?

        I will start to experiment with the SPI interface, since the connector table specifies

        CS (SPI Chip Select)

        Signal/Bus:P103 (SSLA0) 

        and P103 has SSLA0 as a capability?

        Thanks for your help

        Steve K

      Reply
      • Hello Jeremy,

        Thank you for your quick reply. 

        The reference to ra-book is appreciated. I had actually stumbled on it the other day. I'll be reading through it. 

        I tried your GPIO settings and the code is still not working. but I could not change the mode Dropdown because it only contain a Peripheral selection? So I had to disable P103 first in the pins grid, in order to set the Mode to your suggestion. then I was able to change the mode.

        I used the code as you suggested

        ---------------------------------------------------------------

        #define RELAY1  BSP_IO_PORT_01_PIN_03.

        R_BSP_PinAccessEnable();

        // Toggle Relay
        //R_BSP_PinWrite(RELAY1, pin_level);
        R_IOPORT_PinWrite(&g_ioport_ctrl, RELAY1, pin_level);

        /* Protect PFS registers */
        R_BSP_PinAccessDisable();

         _____________________

        At this point I'm assuming it's not working because GPIO is not Capable on this pin, because it is not listed in the "Port Capabilities" list?

        I will start to experiment with the SPI interface, since the connector table specifies

        CS (SPI Chip Select)

        Signal/Bus:P103 (SSLA0) 

        and P103 has SSLA0 as a capability?

        Thanks for your help

        Steve K

      Children
      No Data