Network and CANBUS on TWR-KV58F220

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

Network and CANBUS on TWR-KV58F220

1,125 Views
a8Chcx
Contributor V

Hi,

I am testing the network and CANBUS on TWR-KV58F220 and have the following questions:

1) When I try the httpsrv demo and it does not work. I checked pin_mux, and looks like it is configured for MII0, not RMII0. I am using PE26 as reference input as well. Do you have any sample to work with this kind of configuration? or what do I need to change on existing project?

2) When I am testing on CANBUS, I am using 50 MHz as clock, so, I can't get the exact 48MHz or 60 MHz clock, only 59.375MHz. Do you have any CANBUS timing setting for this or I can just use the settings for 60MHz.?

Thanks,

Christie

Labels (1)
0 Kudos
Reply
5 Replies

781 Views
a8Chcx
Contributor V

Hi,

Here are more information:

1) I am using the same network chip as FRDM-K66. Which initialization routine should I call?

2) I am testing CANBUS based on FRDM-K64F with 250 KBPS. I running at 120MHz. The flexcan is using 60MHz. I set  seg=6, seg1=7, seg2=7,predivder=8, width=3. This works fine with my controller.

When I testing KV58F, I can see it runs at 150MHz, flexcan=75MHz, seg=1, seg1=3, seg2=2,predivder=29, width=1.

These settings are right? why there are the big different between two? How to set these for 75MHz, 118.75MHz?

Thanks,

Christie

0 Kudos
Reply

781 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

I think the "lwip_httpsrv" project uses RMII mode instead of MII mode, for confirmation, you can check the bit 8 of the ENET_RCR in debugger, if it is 1, RMII mode is selected,if it is 0, MII mode is selected.

I have checked the code, it uses RMII mode in default.

Pls check the code:

void ENET_GetDefaultConfig(enet_config_t *config)
{
    /* Checks input parameter. */
    assert(config);

    /* Initializes the MAC configure structure to zero. */
    memset(config, 0, sizeof(enet_config_t));

    /* Sets MII mode, full duplex, 100Mbps for MAC and PHY data interface. */
    config->miiMode = kENET_RmiiMode;
    config->miiSpeed = kENET_MiiSpeed100M;
    config->miiDuplex = kENET_MiiFullDuplex;

    /* Sets the maximum receive frame length. */
    config->rxMaxFrameLen = ENET_FRAME_MAX_FRAMELEN;
}

Regarding your issue that you fail to work for the httpsrv demo, I suspect that you do not configure the jumper both for the TWR-KV58 and TWR-SER boards correctly. Pls set up the jumper based on readme.txt.

Regarding the CAN module, firstly, the baud rate should match by setting the RJW/PSEG1/PSEG2/PROPSEG bits in CANx_CTRL1 register, but the sampling point should be at the same time for transmitter/receiver. Pls refer to section 54.5.8.4 Protocol timing in RM of KV5x.

Hope it can help you

BR

Xiangjun Rong

0 Kudos
Reply

781 Views
a8Chcx
Contributor V

Hi Xiangjun,

I checked it and it is set for RMII as default.

I am using PE26 as reference clock input. Could you tell me where I should set it?

For CANBUS timing, I am using 250bpks, Flexcan clock ==75MHz. It works with  seg=1, seg1=3, seg2=2,predivder=29, width=1 settings(from sample). But, based on timing calculation, there are different. I have the timing setting on FRDM-K64 above, and other CANBUS timing for MCF5282 and etc. They are following the formula for timing calculation. Looks like KV58F is different from other MCUs?

I tried the settings from FRDM-K64, it won't work. Could you tell me how to calculate the timing for KV58F running at 250kpbs(System clock=235.75MHz, and 150MHz)?

Thanks,

Christie

0 Kudos
Reply

781 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

I have checked that the PTE26 is multiplexed with ENET_1588_CLKIN, if you do not use 1588 protocol and just want to use Ethernet protocol, the ENET_1588_CLKIN clock is not required.

Regarding the CAN quata, I have checked the project of "lwip_httpsrv", from the code, i think that the core/sys clock is 150MHz, Bus clock is 75MHz. For the CAN clock, it uses bus clock, so the CAN driving clock is 75MHz/(predivder+1)=2.5MHz, CAN baudrate is 2.5MHz/(PROPSEG + PSEG1 + PSEG2 + 4). Pls check the above three parameter PROPSEG + PSEG1 + PSEG2 in debugger.

If you suspect the bus clock frequency, pls output a clock to CLKOUT pin(PTA6) to verify the clock.

Hope it can help you

BR

Xiangjun rong

0 Kudos
Reply

781 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

It is said that the you should use PHY clock source to drive EXTAL pin, the 50MHz PHY clock should be connected to PTA18, so on the TWR-KV58 board, you should populate the R110, remove the R109. Pls refer to schematics of the TWR-KV58.

BR

Xiangjun Rong

pastedImage_1.png

0 Kudos
Reply