Part Number: TMS320F28386D
Other Parts Discussed in Thread: C2000WARE, , TMS320F28388D, TMDSCNCD28388D
Dear support team,
Since we have some troubles getting the Ethernet interface up and running on our prototype board, I had to deep dive into the features of the Ethernet driver library for the TMS230F28388x. To my surprise I did not only encounter unimplemented functions, but also some straight bugs, that are apparently already present for many years.
I will discuss the issues in separate sections, all referring to the same:
- used driver software: C2000Ware_26_01_00_00
- used Cortex-M4 (CM) application: enet_lwip example
- prototype board: TMS320F28386D EMAC connected in RMII mode to an ADIN1200 PHY
- demo board: TMDSCNCD28388D (TMS320F28388D connected in MII mode to an DP83822 PHY)
Note that we have the enet_lwip example running on the demo board and are debugging the prototype board (hardware), but the issues mentioned are only driverlib_cm related.
MDIO Clause 45 support (incomplete)
The Ethernet_configureMDIO() function offers the option to select Clause 45 MDIO communication with the PHY. However, the API has no function to specify the Device Address that is required for Clause 45 communication, in addition to the register address. For reading and writing the "Clause 45 registers" of the ADIN1200 it is therefore useless to select Clause 45 communication mode and you have to fallback on the Clause 22 access mode for the extended registers of the PHY. Or write your own driver, since the EMAC of the microcontroller does have the Clause 45 support.
MAC_MDIO_Address register overwrites (bug)
The Ethernet_configureMDIO() and Ethernet_configurePHYAddress() functions both set fields of the MAC_MDIO_Address register. Unfortunately, both functions do this by assignment rather than bitmask operations. This means that the settings of the one are reset to zero by the other. This needs to be fixed.
Ethernet_getStatistics() (bug?)
The Ethernet_getStatistics() function implementation seems to assume that the counter registers in the EMAC can be reset to zero by writing the read value to the register, as a kind of acknowledge. However, according to the spruii0f.pdf TRM these registers are read-only, and when stepping through this function, one sees no change to the register by the write action. The result is that each time you call Ethernet_getStatistics() without a reset of the whole EMAC, all values are counted multiple times. It depends of course of your product requirements if this is the behaviour you want. To me, this function is currently implementing the https://en.wikipedia.org/wiki/Lies,_damned_lies,_and_statistics behaviour.