Pin access on the MikroE connector


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 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

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

        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 :-

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

        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_IOPORT_PinWrite(&g_ioport_ctrl, RELAY1, pin_level);

        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.


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

        /* Protect PFS registers */


        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

      • OK , I've loaded in the spi driver.  and I understand what your describing.

        But all I need to do for the relay to work is toggle the CS pin ON High or OFF Low. the SPI module look more complex and is sending and reading bytes, 

        Is there a way to toggle the CS Pin with the SPI module?

        I tried GPIO but it's not capable on this pin? I used GPIO on another board using the same Relay Click. so i assumed I could use GPIO

        Here are the 2 references to the CS pin in the EK-Ra2L1 doc and the Mikroe doc.

        here is the relay click board in the MikroE spec showing  the relay2 on the CS pin

        This is a link to my review in which I'm currently trying to get the MikroeE relay board to work on the EK-RA2L1.

        This is the board review that worked with GPIO

        I appreciate any  direction you can give me. I'll continue to work on find a solution

      • There appears to be an error in the schematics and documentation for the EK-RA2L1 board, from tests it would appear that CS of the MikroBUS connector is connected to P1_04 of the RA2L1, not P1_03.

        The attached project will toggle the CS pin (P1_04) of the MikroBUS connector as a GPIO pin. P1_04 is also SSLA1 for SPI channel 0.

      • I have just realised I have an Engineering Sample board, there is an ES sticker on the back side of the board. The issue with the MikroBUS connector CS pin was fixed for the Mass Production boards.

        Which sort of EK-RA2L1 board do you have?

      • II have an ES sticker on the back of the board also. 

        If you check out my review at RA2L1 EVK(Ultra-Low Power 48MHz Arm® Cortex®-M23) - Review it has all the pictures and the information on the board I'm reviewing for Renesas on the blog.

        I'll check out your code and try using your recommended P1_04 .

      • Your correct Jeremy, I finally got this to work!!

        The documentation  is incorrect in the manual, EK-RA2L1 v1 – User's Manual 

        In section 5.3.5 the CS connector is described as connected to P!03 SSLA0

        The CS pin is for Relay2 (It's a dual relay click) as described in the MikroE  I not sure about Relay1 which is on pin PWM and described a pin/bus P400 (GTIOC6A) , P400 seems to work as defined using the BSP function.

        It should be P!04 (SSLA1). for SPI channel 0.

        I'm using FSP 3.3 and when I create a project and use the project Template "Bare Metal - Blinky"

        P104 is marked "Not Assigned" and the Mode is marked "Disabled" and the "Symbolic Name"  value is blank. 

        But No problem.. I change the value In Mode to "Output Mode (initial High)", the P104 changes to GPIO..

        When I change my code to use P104  the RELAY2 works fine on the MikroeE  click board

        NOTE: RELAY2 is defined in the FSP configurator for P104 in the value for the "Symbolic name".

        I you use the BSP function R_BSP_PinWrite() the first arg is defined locally.

        Thanks for your help 


      • Good to hear you have been successful. Out of interest, where did you get you EK-RA2L1 board from?

      • Hi Jeremy,

        Again, thanks for all your help in diagnosing the problem. It took a lot of my time, which I'll never get back!. I guess I never questioned the documentation. I assume you tested the circuit with a Multimeter? I'd be interested in how you determined the correct pin assignment for CS?

        I have another MikroE click board that I'll try out soon. Hopefully all the pins will be described correctly. I lost some confidence in the docs after this experiences.

        I belong to an excellent Embedded Electronics blog called They have Design Challenges, Webinars, Roadtest Reviews, Projects  etc. They are affiliated with under the Advent community umbrella.

        I received the free EKRA2L1 board, because I was selected as one of the four road testers for

         RA2L1 EVK(Ultra-Low Power 48MHz Arm® Cortex®-M23) on the blog. The Vendor supplied the kits through Newark.

        I've completed my review at 

        My RA2L1 EVK - Review

        Check it out, when you have time it's free to become a member. It's a great blog for me to gain experience with embedded Software Development and be able to get free stuff!

        Check it out and let me know what you think.


        Steve K

      • I used a Multimeter to work out which pin CS on the MikroBUS was.