cancel
Showing results for 
Search instead for 
Did you mean: 

Read register - custom ethernet ic

John Doe1
Associate III

I need a hand with reading registers from ethernet (microchip.com ic).

How I can read offset in ethernet memory?

Section from documentation:

Offset: 0x100h, Size: 32bits
31:16 - chip ip
0:15 - chip revision

My code:

example1:
uint32_t phyreg1 = 0x100h;
HAL_ETH_ReadPHYRegister(&heth, 0, &phyreg1);
 
example2:
uint32_t phyreg2 = 0x100h;
HAL_ETH_ReadPHYRegister(&heth, 1, &phyreg2);
 
example3:
uint32_t phyreg3 = 100;
HAL_ETH_ReadPHYRegister(&heth, 0, &phyreg3);
 

gives bad results. Did I miss something?

4 REPLIES 4

uint32_t phyreg;

HAL_ETH_ReadPHYRegister(&heth, 0x100, &phyreg); // ??

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

What could be a reason if received value is other than expected?

Not powered, connected or clocking correctly?

Stick a logic analyzer on it and compare signalling/response to expectations created by manual/datasheet.

Would suggest enumerating and dumping registers, read 0 thru 0x100 and seeing if anything useful returned. Observe patterns, bit shifts or reversals, ID registers. Functionality that needs unlocking or enabling.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Are you sure?

The application can select one of the 32 PHYs and one of the 32 registers within any PHY
and send control data or receive status information. Only one register in one PHY can be
addressed at any given time.

RADDR: the register address is 5 bits, allowing 32 individual registers to be addressed
within the selected PHY device. The MSB bit of the address is the first transmitted and
received.
Reference manual