Hi Martin,
I cannot find the Input Multiplexing (IMCR) register number and details for MPC5775K ENET MDIO, RX_D0 to RX_D3 in its " IO Signal Description and Input Multiplexing Tables" excel.
I'm using the MPC5775K reference manual, Rev.4, 12/2015 and its attached document(MPC577XK_Muxing_BallMap_Rev2_9.xlsx) for I/O signal description.
In MPC577XK_Muxing_BallMap_Rev2_9.xlsx, its "Input Muxing" tab only has 94 IMCR, and I can only find the IMCR for TX_CLK, RX_CLK and RX_DV
PERMUX | SIUL2 | Destination |
|
|
|
| |||||||||||
permux0 | a90 | 20 | enet_macahb | TX_CLK | disable | low | IO_PAD | PAD_107 | |||||||||
permux0 | ba8 | 90 | enet_macahb | RX_CLK | disable | low | IO_PAD | PAD_49 | IO_PAD | PAD_125 | |||||||
permux0 | bac | 91 | enet_macahb | RX_DV | disable | low | IO_PAD | PAD_50 | IO_PAD | PAD_130 |
Best regiard,
Enwei.
Hi Enwei,
this is source code from ENET driver, which provided me RaceRunner application engineer.
/* MDIO */
SIUL2.MSCR[104].B.SSS = 3;
SIUL2.MSCR[104].B.OBE = 1;
SIUL2.MSCR[104].B.SRC = 3;
SIUL2.MSCR[104].B.IBE = 1;
// Input multiplexing?
/* MDC */
SIUL2.MSCR[105].B.SSS = 3;
SIUL2.MSCR[105].B.OBE = 1;
SIUL2.MSCR[105].B.SRC = 3;
SIUL2.MSCR[105].B.PUE = 1;
/* TX_EN */
SIUL2.MSCR[131].B.SSS = 4;
SIUL2.MSCR[131].B.OBE = 1;
SIUL2.MSCR[131].B.SRC = 3;
/* TDXD0 */
SIUL2.MSCR[99].B.SSS = 3;
SIUL2.MSCR[99].B.OBE = 1;
SIUL2.MSCR[99].B.SRC = 3;
/* TDXD1 */
SIUL2.MSCR[100].B.SSS = 3;
SIUL2.MSCR[100].B.OBE = 1;
SIUL2.MSCR[100].B.SRC = 3;
/* TDXD2 */
SIUL2.MSCR[102].B.SSS = 3;
SIUL2.MSCR[102].B.OBE = 1;
SIUL2.MSCR[102].B.SRC = 3;
/* TDXD3 */
SIUL2.MSCR[106].B.SSS = 3;
SIUL2.MSCR[106].B.OBE = 1;
SIUL2.MSCR[106].B.SRC = 3;
/* COL */
/*
SIUL2.MSCR[10].B.SSS = 0;
SIUL2.MSCR[10].B.IBE = 1;
SIUL2.MSCR[10].B.PUE = 1;
SIUL2.IMCR[968].B.SSS = 1;
*/
/* TX_CLK */
SIUL2.MSCR[107].B.SSS = 0;
SIUL2.MSCR[107].B.IBE = 1;
SIUL2.MSCR[107].B.PUE = 1;
SIUL2.IMCR[20].B.SSS = 1;
/* CRS */
/*
SIUL2.MSCR[76].B.SSS = 0;
SIUL2.MSCR[76].B.IBE = 1;
SIUL2.MSCR[76].B.PUE = 1;
SIUL2.IMCR[970].B.SSS = 1;
*/
/* RX_CLK */
SIUL2.MSCR[125].B.SSS = 0;
SIUL2.MSCR[125].B.IBE = 1;
SIUL2.MSCR[125].B.PUE = 1;
SIUL2.IMCR[90].B.SSS = 2;
/* RX_DV */
SIUL2.MSCR[130].B.SSS = 0;
SIUL2.MSCR[130].B.IBE = 1;
SIUL2.MSCR[130].B.PUE = 1;
SIUL2.IMCR[91].B.SSS = 2;
/* RXD0 */
SIUL2.MSCR[53].B.SSS = 0;
SIUL2.MSCR[53].B.IBE = 1;
SIUL2.MSCR[53].B.PUE = 1;
// Input multiplexing?
/* RXD1 */
SIUL2.MSCR[54].B.SSS = 0;
SIUL2.MSCR[54].B.IBE = 1;
SIUL2.MSCR[54].B.PUE = 1;
// Input multiplexing?
/* RXD2 */
SIUL2.MSCR[116].B.SSS = 0;
SIUL2.MSCR[116].B.IBE = 1;
SIUL2.MSCR[116].B.PUE = 1;
// Input multiplexing?
/* PE13 RXD3 */
SIUL2.MSCR[117].B.SSS = 0;
SIUL2.MSCR[117].B.IBE = 1;
SIUL2.MSCR[117].B.PUE = 1;
// Input multiplexing?
/* RX_ER */
/*
SIUL2.MSCR[11].B.SSS = 0;
SIUL2.MSCR[11].B.IBE = 1;
SIUL2.MSCR[11].B.PUE = 1;
SIUL2.IMCR[967].B.SSS = 1;
*/
/* TX_ER */
/*
SIUL2.MSCR[115].B.SSS = 3;
SIUL2.MSCR[115].B.OBE = 1;
SIUL2.MSCR[115].B.SRC = 3;
*/
Regards,
Martin
Got it, thank you~!:smileyhappy:
Hi Martin
I tried this example in S32DS v1.2 with few changes. But I can't see any packet sent from 192.168.100.5 in wireshark. But the yellow led on ETH of the motherboad flashed quickly when I run the program and it flashed slowly when I stop the program. The green LED is off. Also the register TDAR=0 after I run the function "ENET_UDP_Tx()".
Here are the changes.
1.
2.
3. The Destination Mac addree in ENET_Config.h was changed to my pc address and the ORIGMAC was changed to the address on my motherboard. The ports were remain unchanged.
Where is the problem? Does TDAR=0 show the udp packet was sent successfully? The problem is on the computer?
Or the problem is on the mpc5775k?
Regards
Hai
Hello Hai,
could you please share your edited project? I need to check it on my side.
Regards,
Martin
Hi Martin
Also, my hardware is MPC5775K 356DS and mpc57xxmb. Are there any jumpers I need to pay attention to instead of those jumpers about ENET mentioned in 'MPC5775K EVB Users Guide' ?
Whats more, in the Users Guide:4.9 Configuring External VREG Mode, J43 is mentioned. Is this jumper need to be put on? And I cant find the J43 in 'MPC5775K_356BGA_EVB_Schematic_GM'?
Hi,
I tried the example these days. I was developing a new PC software with MPC5775. But the function of ENET receiving was still very strange . I made up a lot of UDPs and send them into the network. But I only can receive some ARPs which were generated by other APP in the PC.
In the wireshark, we can see that most of packages are UDP. However the IRQ wasn't able to capture them.
First I must comment these two lines, otherwise it couldn't work.
In some cases, it was able to work correctly if I was using the PE multilink to debug it. But it couldn't receive the right UDPs when I disconnect the emulator.
The function of sending was always OK.
I'd like to develop a PC software only using the UDP protocol. How could I do to make the ENET work well?
Thanks.
Hi Martin,
I'm testing the code sample now. I'm not quite sure that my project only can receive the ARP packages . However , I have to transfer information using UDP protocol. Is there some detail I lost in the project?
Regards,
Ron
Hi,
maybe this will be helpful:
https://community.freescale.com/message/624560#comment-624560
It is for other MCU (even from same family) and S32DS instead of GHS, but you may take a look.
Vinchev
Thanks for your advice.
I check the code carefully. Most of them are the same. My problem is that the MCU was able to receive packages. But the type is only ARP. I would like to use UDP protocol to complete my work. It could send UDP in the right way. But It couldn't receive any UDP package in the interrupt handler.
Regards
Ron
After some reading of MPC5748GRM I've deleted my previous post. I didn't reach yet bring-up of the ENET module on my hardware, so reading of that chapter was postponed... It seems that ENET module has Layer 3 functionality...
Hi,
I'm working with MPC5775K. I changed two points in my project. And it could send right UDP packages now.
/* chechsum */
ENET.TACC.B.PROCHK = 1;
ENET.TACC.B.IPCHK = 1;
/* Change frame sizes on the packet before transmitting */
TxBuffer[nextTxBD][16] = ((head_len - ETH_HEADER_LEN + data_len) >> 8) & 0xFF; /* Set the IPV4 frame length on the packet, high byte */
TxBuffer[nextTxBD][17] = (head_len - ETH_HEADER_LEN + data_len) & 0xFF; /* Set the IPV4 frame length on the packet, low byte */
But it was very strange that my project couldn't receive any package now. I set breakpoint in the RX interrupt function. But there was no interrupt event had been captured.
void ENETInit(void)
{
ENET_Driver_Rx_Init();
ENET_UDP_Driver_Init();
}
void ENET_Driver_Rx_Init()
{
// Install the receive frame interrupt handler
//INTC_InstallINTCInterruptHandler(ENET_Rx_Handler, 218, CPU0, 1);
INTC.PSR[218].B.PRC_SELN0 = 0x1;
INTC.PSR[218].B.PRIN = 10;/* max = 31 */
// Enable the generation of Rx frame interrupts
ENET.EIMR.B.RXF = 1;
// Indicate Empty buffers have been produced
ENET.RDAR.B.RDAR = 1;
}
void ENET_UDP_Driver_Init(void)
{
ENET_GPIO_Init(); // Initialize PADs
ENET_BUFFER_Init(); // Initialize buffer descriptors and data buffers
/* reset the ENET - clears EIR, etc. */
ENET.ECR.B.RESET = 1;
ENET.ECR.B.EN1588 = 1; /* Enable enhanced functionalities */
/* Set the source address for the controller */
ENET.PALR.R = ((ORIGMAC1<<24) + (ORIGMAC2<<16) + (ORIGMAC3<<8) + ORIGMAC4); //set to match DA in packet
ENET.PAUR.R = ((ORIGMAC5<<24) + (ORIGMAC6<<16));
//initially no hash matching
ENET.IALR.R = 0x00000000; //no individual hash matching
ENET.IAUR.R = 0x00000000;
ENET.GALR.R = 0x00000000; //no group hash matching
ENET.GAUR.R = 0x00000000;
// Set Receive Buffer Size
ENET.MRBR.R = (uint16_t)RX_BUFFER_SIZE;
// Point to the start of the circular Rx buffer descriptor queue
ENET.RDSR.R = (uint32_t)&rxbd[0];
// Point to the start of the circular Tx buffer descriptor queue
ENET.TDSR.R = (uint32_t)&txbd[0];
ENET.RCR.B.PADEN = 1; /* Enable Padding removing when receiving frames */
/* Set the transceiver interface to MII mode */
ENET.RCR.B.MAX_FL = 1518; //MAX_FL = 1500 payload + 18(for DA(6), SA(6), Ethertype(2) and CRC(4))
ENET.RCR.B.MII_MODE = 1; //MII mode - 18 signals;
/* LOOPBACK */
ENET.RCR.B.LOOP = 0; /* Disable loopback mode */
/* Operate in full-duplex mode */
ENET.TCR.R = 0x0004;
/* Set MII speed to be 50/((MSCR+1)*2) = 2.5Mhz */
ENET.MSCR.R = 0x4;
ENET.TACC.B.PROCHK = 1;
ENET.TACC.B.IPCHK = 1;
/* Enable FEC */
ENET.ECR.B.ETHEREN = 1;
}
The interrupt function was installed on the NO.218 handle.
(uint32_t) &ENET_Rx_Handler, /* Vector # 218 RX ENET_0 */
Regards,
Ron
You might take a look at this thread:
You'll find LWIP ported for MPC5748G, should not be much different for your MCU...
Thanks,
I don't quite understand how to configure the SUIL2.IMCR
I find that RXD0 RXD1 RXD2 RXD3 should be set the IMCR registers. But I don't know how to configure them.
void ENET_GPIO_Init(void)
{
/* MDIO */
SIUL2.MSCR[104].B.SSS = 3;
SIUL2.MSCR[104].B.OBE = 1;
SIUL2.MSCR[104].B.SRC = 3;
SIUL2.MSCR[104].B.IBE = 1;
// Input multiplexing?
/* MDC */
SIUL2.MSCR[105].B.SSS = 3;
SIUL2.MSCR[105].B.OBE = 1;
SIUL2.MSCR[105].B.SRC = 3;
SIUL2.MSCR[105].B.PUE = 1;
/* TX_EN */
SIUL2.MSCR[131].B.SSS = 4;
SIUL2.MSCR[131].B.OBE = 1;
SIUL2.MSCR[131].B.SRC = 3;
/* TDXD0 */
SIUL2.MSCR[99].B.SSS = 3;
SIUL2.MSCR[99].B.OBE = 1;
SIUL2.MSCR[99].B.SRC = 3;
/* TDXD1 */
SIUL2.MSCR[100].B.SSS = 3;
SIUL2.MSCR[100].B.OBE = 1;
SIUL2.MSCR[100].B.SRC = 3;
/* TDXD2 */
SIUL2.MSCR[102].B.SSS = 3;
SIUL2.MSCR[102].B.OBE = 1;
SIUL2.MSCR[102].B.SRC = 3;
/* TDXD3 */
SIUL2.MSCR[106].B.SSS = 3;
SIUL2.MSCR[106].B.OBE = 1;
SIUL2.MSCR[106].B.SRC = 3;
/* COL */
/*
SIUL2.MSCR[10].B.SSS = 0;
SIUL2.MSCR[10].B.IBE = 1;
SIUL2.MSCR[10].B.PUE = 1;
SIUL2.IMCR[968].B.SSS = 1;
*/
/* TX_CLK */
SIUL2.MSCR[107].B.SSS = 0;
SIUL2.MSCR[107].B.IBE = 1;
SIUL2.MSCR[107].B.PUE = 1;
SIUL2.IMCR[20].B.SSS = 1;
/* CRS */
/*
SIUL2.MSCR[76].B.SSS = 0;
SIUL2.MSCR[76].B.IBE = 1;
SIUL2.MSCR[76].B.PUE = 1;
SIUL2.IMCR[970].B.SSS = 1;
*/
/* RX_CLK */
SIUL2.MSCR[125].B.SSS = 0;
SIUL2.MSCR[125].B.IBE = 1;
SIUL2.MSCR[125].B.PUE = 1;
SIUL2.IMCR[90].B.SSS = 2;
/* RX_DV */
SIUL2.MSCR[130].B.SSS = 0;
SIUL2.MSCR[130].B.IBE = 1;
SIUL2.MSCR[130].B.PUE = 1;
SIUL2.IMCR[91].B.SSS = 2;
/* RXD0 */
SIUL2.MSCR[53].B.SSS = 0;
SIUL2.MSCR[53].B.IBE = 1;
SIUL2.MSCR[53].B.PUE = 1;
// Input multiplexing?
/* RXD1 */
SIUL2.MSCR[54].B.SSS = 0;
SIUL2.MSCR[54].B.IBE = 1;
SIUL2.MSCR[54].B.PUE = 1;
// Input multiplexing?
/* RXD2 */
SIUL2.MSCR[116].B.SSS = 0;
SIUL2.MSCR[116].B.IBE = 1;
SIUL2.MSCR[116].B.PUE = 1;
// Input multiplexing?
/* PE13 RXD3 */
SIUL2.MSCR[117].B.SSS = 0;
SIUL2.MSCR[117].B.IBE = 1;
SIUL2.MSCR[117].B.PUE = 1;
// Input multiplexing?
/* RX_ER */
/*
SIUL2.MSCR[11].B.SSS = 0;
SIUL2.MSCR[11].B.IBE = 1;
SIUL2.MSCR[11].B.PUE = 1;
SIUL2.IMCR[967].B.SSS = 1;
*/
/* TX_ER */
/*
SIUL2.MSCR[115].B.SSS = 3;
SIUL2.MSCR[115].B.OBE = 1;
SIUL2.MSCR[115].B.SRC = 3;
*/
}
Hi,
input multiplexing is not so difficult. Let's look for example at the MSCR[11] (RX_ER). Code should be following:
SIUL2.MSCR[11].B.SSS = 0;
SIUL2.MSCR[11].B.IBE = 1;
SIUL2.MSCR[11].B.PUE = 1;
SIUL2.IMCR[455].SSS = 1;
Now ENET_0 RX_ER is connected to PA[11].
I calculated number 455 as follows:
IMCR is defined as array with 512 elements. If there is number 967 in IO_signal_description you have to calculate:
967-512 = 455
Now you can use 455 in IMCR input muxing.
Regards,
Martin
Hi,
My device connect the PC by a line directly. I'm using the wireshark to monitor the status of all the packages. It seems that the device capture a few of packages. Most of packages are lost. Does it filter packages by the MAC address? And how could I capture all the packages in the interrupt function?
Thanks and Regards,
Ron
Martin,
Thank you very much! :smileyhappy:
Best regards,
Ron