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.

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

      Reply Children