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.

      • 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

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

      Children
      • 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.

        FSP_3_3_0_EK_RA2L1_Mikro_Bus_CS_Pin.zip

      • 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 element14.com 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 

        SteveK

      • 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 element14.com. They have Design Challenges, Webinars, Roadtest Reviews, Projects  etc. They are affiliated with hackster.io 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 element14.com 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.

        Regards,

        Steve K

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

      • Hi Steve K-

        Thanx for all your work on your review and sharing the issues you ran into. This will help us improve our products and documentation. I read over your review and it is very, very detailed. Everything from unboxing photos, to registering on the web site, to logging a ticket on the support portal, to doing the Blinky tutorial, to getting your project working. WoW!

        I'm sharing your work with our marketing team so they can address the areas for improvement you identified. Thanx!

      • Wow! Thank you Warren for reading and commenting on my element14 review.  I’m having fun with the kit.

        When I get some time, I plan on doing a blog here on the kit and the mikroE connector.