no UART Communication in UART1 in Renesas RL78G14 RDK board.

Hello,

I am using Renesas RL78G14 RDK board.

I downloaded the sample IAR project from below link:
http://in.renesas.com/support/downloads/download_results/C1000000-C9999999/tools/yrdkrl78g14_factory_demo_v39.jsp

I am unable to see UART communication in any mode supported.

I guess it looked like clocking issue.
I found multiple definition for clock freq.

/* YRDKRL78G14.h */
#define RL78_MAIN_SYSTEM_CLOCK          12000000    /* MHz */
#define RL78_SUBSYSTEM_CLOCK            32768       /* kHz */
#define RL78_INTERNAL_LOWSPEED_CLOCK    15000       /* kHz */

/* UART.c */
#define MAIN_SYSTEM_CLOCK        32000000

Could anybody confirm which value needs to be used for baud rate calculation?

Current code uses macro MAIN_SYSTEM_CLOCK

Also if any other issue is suspected in UART in RL78G14 board would really helpful

Thanks!!

regards,
Hemanth

UPDATE:

Enabling of UART-1 Tx & Rx by setting the Register "SS10", causes Higher 7 bits of the serial data register SDR02 & SDR03 to reset. How can i prevent the reset happening?

  • Are you sure the bits are reset, or can you only not see the value any more?

    I think the values are only not shown when the serial interface is in use.

    When you disable the serial interface you should see the value again.

  • As it comes, the yrdkrl78g14_factory_demo_v39 project only uses these serial ports on SAU1 (Serial Array Unit 1):

    - CSI20 on port P13/P14/P15 pins (same as 3-wire SPI) to interface to GainSpan GS1011 module

    - CSI21 on port P70/P71/P72 pins (same as 3-wire SPI) to interface to Okaya Graphics LCD panel

    - and also uses IICA0 on port P60/P61 pins (I2C in Master Mode) to interface to Accelerometer, Temp and Light Sensors

    If you want to use UART1 which is on Channel 2 and Channel 3 in SAU0, you will have to issue R_SAU0_Create() which is in source file folder path \Factory_Demo_V39\YRDKRL78G14\applilet3_src\r_cg_serial.c

    R_SAU0_Create() turns on the clock (SAU0EN = 1U;) for SAU0 and calls R_UART1_Create()

    Then you can use the other UART1 functions to start or stop and run UART1.

    The baud rate can be set separately for both UART1 receive and UART1 transmit.

    SPS0 register sets which main clock and divider that goes to SAU0, channel 2 (UART1 Transmit shift register) and channel 3 (UART1 Receive Shift register).

    SPS0 is set in R_SAU0_Create(void)

    SDR02 (upper 7 bits) sets the UART1 transmit baud rate divisor

    SDR03 (upper 7 bits) sets the UART1 receive baud rate divisor

    Both SDR02 and SDR03 are set in R_UART1_Create()  function.

    Have you called R_SAU0_Create() first?

    -Mike/Renesas

  • Hi Mike,

    Thanks for the detailed response.

    I was trying the "App_PassThroughSPI" mode. When I went further I figured out that the UART is not communicating.

    I tried monitoring of COM port for transmission("PassThroughSPI:\r\n") in UART after entering "App_PassThroughSPI" but couldn't see anything.

    While debugging I figured the Upper 7-bits(SDR02[15:9] & SDR03[15:9]) are reset after enabling UART-1

    (SS0 |= _0008_SAU_CH3_START_TRG_ON | _0004_SAU_CH2_START_TRG_ON; /* enable UART1 receive and transmit */)

    Not sure if this is the issue Or not.

    But I am unable to see any data in COM port.

    regards,

    Hemanth

  • Hi Hemanth,

    I'm sorry, but I have not tried the demo that uses "App_PassThroughSPI" mode.

    If the Upper 7-bits(SDR02[15:9] & SDR03[15:9]) are reset (zero) that would set a divide by 2 after the fMCK clock.

    If using option byte 000C2H = 0xE8 (fHOCO = 32MHZ, fIH = 32MHZ) or 0xF8 (fHOCO = 64MHZ, fIH = 32MHZ),

    then fCLK in the SAU0 block = 32MHZ.

    To get 115.2Kbaud, you would use CK00, and SPS0 set to 0x0001 gives fMCK = 16MHZ

    Then, 16MHZ/138 = 115.942Kbaud, which is the closest setting to 115.2Kbaud.

    To get divide by 138, set Upper 7-bits(SDR02[15:9] & SDR03[15:9]) to binary 1000101 (OR the SDR02/SDR03 registers with 0x8A00).

    Do you have the DipSW5, position4 set to ON?  (SW4 ON gives Power to the GainSpan GS1011 module)  For debug mode the DIPSW5 should be set to:

    SW1 ON

    SW2 OFF

    SW3 ON

    SW4 ON

    Have you tried the yrdkrl78g14_factory_demo_v39 in Demo1 mode (pushbutton switches SW1, SW2, SW3 NOT pressed on startup) to see if the basic GainSpan demo of YRDKRL78 sensors (Accelerometer, Temp, Light) works?

    -Mike

  • Hi Mike,

    I am able to try Demo#1, Demo#2, Demo#3 & Demo#5.

    All of these seems to be working fine.

    I even enabled macros to print debug info on serial port (ATLIBGS_DEBUG_ENABLE, HOST_APP_DEBUG_ENABLE)

    I tried monitoring of UART data in

    1. Serial connector (J13) pin no 2 & 3

    2. Pin 94 & Pin 95 in Renesas MCU

    But I don't observe any data.

    regards,

    Hemanth

  • hemanth,

    Have you resolved your issue?

    Mike Clements

    RenesasRulz Moderator