Other Parts Discussed in Thread: AMIC110
Hi,
I'a trying to implement a simple Raw data transmission using PRU MII on a AM3358.
The scenario is as follow:
PRU0 generates RAW data and tries to send it via MII TX1.
Here is PRU0 code:
#define TX_PUSH16 (1<<25) #define TX_EOF (1<<29) void main(void) { // set ocp_clk source 200 MHz CT_CFG.IEPCLK_bit.OCP_EN = 1; // selected configuration (such as MII_RT, Parallel Capture,Shift Out, and direct connection) CT_CFG.GPCFG0_bit.PRU0_GPI_MODE = 0b11; // set TX_CLK_DELAY to 6h CT_MII_RT.TXCFG1_bit.TX_CLK_DELAY1 = 0x6; CT_MII_RT.TXCFG1_bit.TX_START_DELAY1 = 0x40; // PRU Internal Pinmuxing CT_CFG.PIN_MX_bit.PIN_MUX_SEL = 0; // select TX source pru0 or pru1 CT_MII_RT.TXCFG1_bit.TX_MUX_SEL1 = 0b0; //TX1 data from PRU0 CT_MII_RT.TXCFG1_bit.TX_AUTO_PREAMBLE1 = 1; CT_MII_RT.TXCFG1_bit.TX_ENABLE1 = 1; //NOW We can Start our data transmission volatile uint32_t gpo; int i; while(1) { gpo = 0; for (i=0; i<50; i++)//send the raw data { gpo += 0x00000001; //Data to be transmited __R30 = 0xFFFF0000 | gpo; //TX mask to transmit data from R30, not RX FIFO __R31 = TX_PUSH16; //push to the mii tx } __R30 = 0xFFFF0001; // 0x1 - data __R31 = TX_PUSH16 | TX_EOF; //push to the mii tx, EOF_TX, send the pack finish __delay_cycles(40000); } __halt(); /* Should never return */ return; }
And this is my gel file for external PRU MII1 Pinmux:
//********************************************************* // MDIO_PRUSS //********************************************************* /* (V12) gpmc_clk.pr1_mdio_mdclk - mode 5 */ *((unsigned int*) 0x44e1088c) = AM335X_PIN_OUTPUT_PULLUP | 5; /* (T13) gpmc_csn3.pr1_mdio_data - mode 5 */ *((unsigned int*) 0x44e10888) = AM335X_PIN_INPUT_PULLUP | 5; //********************************************************* // MII_PRUSS //********************************************************* /* (R13) gpmc_a0.pr1_mii_mt1_clk */ *((unsigned int*) 0x44e10840) = AM335X_PIN_INPUT | 5; /* (R14) gpmc_a4.pr1_mii1_txd0 */ *((unsigned int*) 0x44e10850) = AM335X_PIN_OUTPUT | 5; /* (T14) gpmc_a3.pr1_mii1_txd1 */ *((unsigned int*) 0x44e1084c) = AM335X_PIN_OUTPUT | 5; /* (U14) gpmc_a2.pr1_mii1_txd2 */ *((unsigned int*) 0x44e10848) = AM335X_PIN_OUTPUT | 5; /* (V14) gpmc_a1.pr1_mii1_txd3 */ *((unsigned int*) 0x44e10844) = AM335X_PIN_OUTPUT | 5; /* (V16) gpmc_a8.pr1_mii1_rxd0 */ *((unsigned int*) 0x44e10860) = AM335X_PIN_INPUT | 5; /* (T15) gpmc_a7.pr1_mii1_rxd1 */ *((unsigned int*) 0x44e1085c) = AM335X_PIN_INPUT | 5; /* (U15) gpmc_a6.pr1_mii1_rxd2 */ *((unsigned int*) 0x44e10858) = AM335X_PIN_INPUT | 5; /* (V15) gpmc_a5.pr1_mii1_rxd3 */ *((unsigned int*) 0x44e10854) = AM335X_PIN_INPUT | 5; /* (U17) gpmc_wpn.pr1_mii1_txen */ *((unsigned int*) 0x44e10874) = AM335X_PIN_OUTPUT | 5; /* (U16) gpmc_a9.pr1_mii_mr1_clk */ *((unsigned int*) 0x44e10864) = AM335X_PIN_INPUT | 5; /* (T16) gpmc_a10.pr1_mii1_rxdv */ *((unsigned int*) 0x44e10868) = AM335X_PIN_INPUT | 5; /* (V17) gpmc_a11.pr1_mii1_rxer */ *((unsigned int*) 0x44e1086c) = AM335X_PIN_INPUT | 5; /* (U18) gpmc_be1n.pr1_mii1_rxlink */ //*((unsigned int*) 0x44e10878) = AM335X_PIN_INPUT | 5; /* (R6) lcd_ac_bias_en.pr1_mii1_crs */ *((unsigned int*) 0x44e108ec) = AM335X_PIN_INPUT | 2; /* (T17) gpmc_wait0.pr1_mii1_col */ *((unsigned int*) 0x44e10870) = AM335X_PIN_INPUT | 5;
Q1- I'm trying to receive sent data in my PC and see it in Wireshark, BUT with no success. Is there any problem with my firmware code??
I have tested MDIO connection between PRU and PHY by reading and writing to its register and it works.
Q2- What are the minimum MII Registers configurations for auto forwarding MII RX1 data to MII TX1 to try another simple scenario to see if it works??
Thanks in advance