sending AT command via UART

Hi All,

 

I am trying to sending AT command from a Mdot on a board which has R5F100LEA as a uC to a Xdot or vice versa. The sample code in Renesas does not help a lot. So does anyone has sample code of sending AT command via UART or has any experience before?

Thanks in advance.

  • William,

    Have you found the code you were looking for?

    Mike Clements
    RenesasRulz Moderator
  • In reply to Mike Clements:

    Hi Mike,

    No, but I actually find my own way to solve the problem. Thanks for asking.

    Regards,
    William
  • Well I do not use R5F100LEA but have exposure to R5100FE.
    I have interfaced UART of ZigBee's ZE10 module to UART0 of Renesas and sending AT Command via UART is as easy as follows.

    For example: If we need to configure ZigBee as End Device, the command is AT+NT=3 and this is how I have done:
    R_UART0_Send("AT+NT=3\r\n",9);
    while(UART0_TxComplete);

    Now before you patch the above two lines, here are few things to be done:
    1) Declare UART0_TxComplete in r_userdefine.h as follows -
    extern uint8_t UART0_TxComplete;

    2) Declare the same in r_cg_serial.c this way
    uint8_t UART0_TxComplete;

    3) In the same file of r_cg_serial.c search for R_UART0_Send() is as follows
    MD_STATUS R_UART0_Send(uint8_t * const tx_buf, uint16_t tx_num)
    {
    MD_STATUS status = MD_OK;

    if (tx_num < 1U)
    {
    status = MD_ARGERROR;
    }
    else
    {
    gp_uart0_tx_address = tx_buf;
    g_uart0_tx_count = tx_num;
    STMK0 = 1U; /* disable INTST0 interrupt */
    TXD0 = *gp_uart0_tx_address;
    gp_uart0_tx_address++;
    g_uart0_tx_count--;
    STMK0 = 0U; /* enable INTST0 interrupt */
    }

    return (status);
    }
    Just before return(status) define the variable as follows
    MD_STATUS R_UART0_Send(uint8_t * const tx_buf, uint16_t tx_num)
    {
    MD_STATUS status = MD_OK;

    if (tx_num < 1U)
    {
    status = MD_ARGERROR;
    }
    else
    {
    gp_uart0_tx_address = tx_buf;
    g_uart0_tx_count = tx_num;
    STMK0 = 1U; /* disable INTST0 interrupt */
    TXD0 = *gp_uart0_tx_address;
    gp_uart0_tx_address++;
    g_uart0_tx_count--;
    STMK0 = 0U; /* enable INTST0 interrupt */
    }
    UART0_TxComplete=1;
    return (status);
    }

    4) Now in the file r_cg_serial_user.c search for a function static void r_uart0_callback_sendend(void) and define it as follows:

    static void r_uart0_callback_sendend(void)
    {
    /* Start user code. Do not edit comment generated here */
    UART0_TxComplete=0;
    /* End user code. Do not edit comment generated here */
    }

    Thats it!
  • In reply to William:

    William,

    I am glad to hear that you have resolved your issue.
    Can you share your solution with our community?

    Mike Clements
    RenesasRulz Moderator
  • In reply to William:

    This thread will be archived due to inactivity.

    Mike Clements
    RenesasRulz Moderator