Tool/software: TI-RTOS
Hello!
I try to understand the pru mii firmware from the TI_RTOS to write my own driver. My test function for pack sending is:
int i;
while(1){
for (i=0; i<(packSize/2); i++)
__R30 = 0xFFFF0000|udpArray[i];//mask disable
__R31 = (1<<25);//push to the mii tx
}
__R31 = (1<<29)|(1<<26)|(1<<27);//EOF+CRC_LOW+CRC_HIGH
This is a simplest function only for packs less then 80 bytes, at the another case I need to insert delay for the TX FIFO get free place. This function work, but the CRC is wrong (in most cases, sometimes correct). I can know it becouse I have two computers: one can receive packs with wrong CRC, another - can not. The first computer get the packs, the second - not. If I write the crc at the and of the pack and change the last line to "__R31 = (1<<29);" - both computers get the packs.
I open the firmware at the TI-RTOS to look an example and find the file "emac_MII_Xmt.h", where are the next macroses:
;----------------------------------- ; Macro Name: M_XMT_INSERT_CRC_ICSS_REV1 ; Description: Insert the CRC in outgoing frame on ICSS_REV1. ; Input Parameters: none ; Output Parameters: none ;----------------------------------- M_XMT_INSERT_CRC_ICSS_REV1 .macro M_PUSH_CRC_MSWORD LDI TEMP_REG_4.b2, 4 WAIT R3.b2 M_PUSH_CRC_LSWORD .endm ;----------------------------------- ; Macro Name: M_XMT_INSERT_CRC_ICSS_REV2 ; Description: Insert the CRC in outgoing frame on ICSS_REV2. ; Input Parameters: none ; Output Parameters: none ;----------------------------------- M_XMT_INSERT_CRC_ICSS_REV2 .macro LDI R31.w2 , 0x2C00 .endm
What different between ICSS_REV1 and ICSS_REV2? At one case it is "LDI R31.w2 , 0x2C00" (the same as my "__R31 = (1<<29)|(1<<26)|(1<<27);//EOF+CRC_LOW+CRC_HIGH"), at another case is delay between CRC_HIGH and CRC_LOW. I can not find where calculates the delay (R3.b2) and where these macroses are used. But I find the file "icss_emac_pru1_bin.h", and disassemble some lines. At this files the commands "TX_EOF", "TX_CRC_HIGH" and "TX_CRC_LOW" uses at different places (as at the macro M_XMT_INSERT_CRC_ICSS_REV1, not M_XMT_INSERT_CRC_ICSS_REV2).
I dont find any recomemdations how (and when) use the CRC commands at the documentation (document: spruh73p.pdf). Where I can find such recomendations?