FRDM K64F

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM K64F

512 Views
girishkumarch
Contributor II

I am a newbie to Freescale K64F.......

I want simple UDP example using MQX RTCS.....

can any one help?

Tags (1)
0 Kudos
3 Replies

375 Views
girishkumarch
Contributor II

Hi,

I am using the following code(MQX-4.2 & KSDK-1.2), just to bring up the  ethernet interface .I got compiled properly ,but the board is not able to get pinged from the remote PC which is also in the same subnet (in fact , PC IP address is 10.2.1.56).

I am using FRDM-K64F board.

CAn any body makes out, what mistake or what steps i am missing to be able to make it ping.

Ethernet Link and activity LEDs are blinking properly.

#include <mqx.h>

#include <bsp.h> 

#include <fio.h>

#include <rtcs.h>

#include <ipcfg.h>

#include "enet.h"

#if ! BSPCFG_ENABLE_IO_SUBSYSTEM

#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined non-zero in user_config.h. Please recompile BSP with this option.

#endif

#ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED

#error This application requires BSP_DEFAULT_IO_CHANNEL to be not NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero in user_config.h and recompile BSP with this option.

#endif

/* Task IDs */

#define HELLO_TASK 5

#define ETH_TASK 6

//#define BSP_DEFAULT_ENET_DEVICE 1

#define ENET_IPADDR IPADDR(10,2,1,100)

#define ENET_IPMASK IPADDR(255,255,0,0)

#define ENET_IPGATEWAY IPADDR(0,0,0,0)

extern void hello_task(uint32_t);

const TASK_TEMPLATE_STRUCT MQX_template_list[] = {

/* Task Index,   Function,   Stack,  Priority, Name,     Attributes,          Param, Time Slice */

{ HELLO_TASK, hello_task, 4500, 8, "hello", MQX_AUTO_START_TASK, 0, 0 }, { 0 } };

/*TASK*-----------------------------------------------------

*

* Task Name    : hello_task

* Comments     :

*    This task prints " Hello World "

*

*END*-----------------------------------------------------*/

void hello_task(uint32_t initial_data) {

    (void) initial_data; /* disable 'unused variable' warning */

    IPCFG_IP_ADDRESS_DATA ip_data;

    _enet_handle ehandle;

    _rtcs_if_handle ihandle;

    uint32_t error;

    _ip_address new_target;

    _enet_address enet_address;

    /* runtime RTCS configuration */

    _RTCSPCB_init = 4;

    _RTCSTASK_priority = 4;

    _RTCSTASK_stacksize = 3500;

    _RTCSPCB_grow = 2;

    _RTCSPCB_max = 6;

    _RTCS_socket_part_init = 4;

    _RTCS_socket_part_grow = 2;

    _RTCS_socket_part_max = 6;

    error = RTCS_create();

    if (error != RTCS_OK) {

        printf("RTCS failed to initialize, error = 0x%X\n", error);

        _task_block();

    }

    ENET_get_mac_address(BSP_DEFAULT_ENET_DEVICE, ENET_IPADDR, enet_address);

    error = ipcfg_init_device(BSP_DEFAULT_ENET_DEVICE, enet_address);

    if (error != RTCS_OK) {

        printf("IPCFG: ENET init failed. Error = 0x%X\n", error);

        _task_block();

    }

    ip_data.ip = ENET_IPADDR;

    ip_data.mask = ENET_IPMASK;

    ip_data.gateway = ENET_IPGATEWAY;

    error = ipcfg_bind_staticip(BSP_DEFAULT_ENET_DEVICE, &ip_data);

    if (error != RTCS_OK) {

        printf("\nIPCFG: Failed to bind IP address. Error = 0x%X", error);

        _task_block();

    }

 

}

0 Kudos

375 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

Here is an example code in RTCS User's Guide. Please check the following document

C:\Freescale\Freescale_MQX_4_2\doc\rtcs\MQX_RTCS_User_Guide.pdf

Page 50, section 3.30

Regards

Daniel

0 Kudos

375 Views
girishkumarch
Contributor II

Hi Daniel,

Will the same example covers the Ping also,

And where we have to mention the IP ADDRess,NETMASK,Gateway Etc

0 Kudos