Configuration of SJA1105 Application Board through python scripts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuration of SJA1105 Application Board through python scripts

1,457 Views
jorge_cifuentes
Contributor II

Hi,

I have a setup of three S32K148EVB boards with their respective ADTJA1101 (Automotive ethernet) module. I am able to send ethernet frames between two of the boards when they are connected directly one to another but now I wish to be able to send frames among the three boards. I am using a SJA1105 Application Board to achieve this. I have the AH1508 User Manual and downloaded the software package as indicated. Unfortunately I have not been able to configure the SJA1105 Application Board so my boards are able to send ethernet frames among them.

I assume I must load the MAC addresses so the switch knows where to forward the received frames, but I don't know how to do this through the python scripts. I am using the "create_config_Basic_L2_Switching_No_Priority_Queue_RMII_100.py" as a base and created a copy I named "create_myconfig_Basic_L2_Switching_No_Priority_Queue_RMII_100.py" for my changes.

Also I would like to know how to setup all PHYs on the board as masters. Can someone please help me? I will appreciate any guidance! 

I attached the two python scripts I mentioned previously. 

 

P.S. The MAC addresses I setup for my boards are:
11:22:33:44:55:66

22:33:44:55:66:77

33:44:55:66:77:88


Thank you!
Best regards,
Jorge

0 Kudos
5 Replies

1,413 Views
bpe
NXP Employee
NXP Employee


First of all, two of the three MAC addresses you give to your boards have I/G bit set. This means they are group addresses, treated specially and should not be used as a station individual MAC address. See IEEE 802.3 Sections 3.2.3 for details.

If you want your SJA1105 to do basic L2 switching, you do not have to fill the address lookup table explicitly in your configuration. create_config_Basic_L2_Switching_No_Priority_Queue_RMII_100.py. enables flooding and learning mechanisms which deal with unknown MAC addresses.

To isolate the porblem, set your board rotary switch into the "1" position. This autoconfigures the switch to do what a typical L2 switch is expected to do after powerup. If it is not working after that, the problem is most likely not in the switch. Use smi_read and smi_write python calls to read the PHY registers to see if the link is up. The same is for setting the PHY as a master or slave. Refer to AH1508 Section 4.3 and to  the PHY documentation for more information.

Hope this helps,
Platon

0 Kudos

1,395 Views
jorge_cifuentes
Contributor II

Hi Platon,

Thank you for your reply. I corrected my MAC addresses to something valid, according to the standard. I am not sure what I was doing wrong the last time. I am using the SJA1105 Application Board with the rotary switch in the "1" position and now I am able to have two of my boards with the link up when connected to the switch. Both boards send Ethernet frames but do not receive anything. If I connect both boards directly, they can send and receive Ethernet frames. I see the same behavior if I leave the default configuration of the switch with the rotary switch in "1" and if I load the "config_Basic_L2_Switching_No_Priority_Queue_RMII_100" example.

Maybe its worth to  clarify that my boards are using "plain" ethernet frames: destination address, source address, length and payload. Their payload has a custom content that I am using for my project. I am not using any protocol over Ethernet. Do you think this may be causing issues to the switch? 

Thanks!

Jorge

0 Kudos

1,375 Views
bpe
NXP Employee
NXP Employee

It is possible to configure the switch to look at the header fields other than L2 addresses, but simple example configurations do not do that. Did you dump the switch diagnostic registers (read_highlevel_diagnostic_registers.py)?

Best Regards,
Platon

 

0 Kudos

1,361 Views
jorge_cifuentes
Contributor II

Hi Platon,

 

When you talk about "L2 addresses" do you mean MAC addresses or IP addresses? I ran the script you suggested and all the diagnostic registers of the switch are in zero. This is the output of the script:

REGISTER Port0 Port1 Port2 Port3 Port4
N_TXBYTE     0       0       0       0       0
N_TXFRM      0       0       0       0      0
N_RXBYTE    0       0       0       0      0
N_RXFRM     0       0        0       0      0
Diagnostic Registers Read Sucessfully

Does that mean they are not configured? I am turning the rotary switch into position "1" before turning on the switch. After that, I run this py script to set one of the PHYs to be a slave as one of my boards is configured as master:

eth_switch = SJA1105_Platform(8)

#enable access to configuration register
reg = eth_switch.smi_read(4,17)
reg |= 0x0004
eth_switch.smi_write(4,17,reg)

#configure PHY 1 (address 4) as slave
reg = eth_switch.smi_read(4,18)
reg &= 0x7FFF
eth_switch.smi_write(4,18,reg)

#disable access to configuration register
reg = eth_switch.smi_read(4,17)
reg &= ~(0x0004)
eth_switch.smi_write(4,17,reg)

#enable link control
reg = eth_switch.smi_read(4,17)
reg |= 0x8000
eth_switch.smi_write(4,17,reg)

Then, I execute the program on my two boards but as I said before, they are only able to send frames but not receive them. Do you know what should the diagnostic registers of the switch have? If there is any documentation available that does not require NDA, I would appreciate you could point me to it. I am working on my own so I don't have a company that can back me up for the NDA. I only posses the AH1508 document but it does not have much information that can help me solve my issue.

Thanks!

Best regards,

Jorge

0 Kudos

1,322 Views
bpe
NXP Employee
NXP Employee

When you talk about "L2 addresses" do you mean MAC addresses or IP addresses?

[Platon] Be advised to familiarize with the fundamentals of the technology
area you are working in. This is required to understand the documentation of
the products you are using and the the suggestions you are given:

https://en.wikipedia.org/wiki/OSI_model#Layer_2:_Data_Link_Layer

MAC addresses belong to L2.

I ran the script you suggested and all the diagnostic registers of the switch
are in zero. This is the output of the script:

REGISTER Port0 Port1 Port2 Port3 Port4
N_TXBYTE 0 0 0 0 0
N_TXFRM 0 0 0 0 0
N_RXBYTE 0 0 0 0 0
N_RXFRM 0 0 0 0 0
Diagnostic Registers Read Sucessfully

[Platon] Zeroes mean your switch does not see any traffic at all. This is most
likely because the link is not established by the PHYs. See the suggestion
given earlier in this thread about reading the link status from the PHY.

Does that mean they are not configured?

[Platon] You cannot "configure" them. They are statistics counters. See the
Software user manual of your switch model, section titled "Ethernet port status"
for more information about these  registers.

 I run this py script to set one of the PHYs to be a slave as one
of my boards is configured as master.

[Platon] Use the board ports configured as slaves out of reset to sort out
potential script issues. See AH1508, Table 1.

If there is any documentation available that does not require NDA, I would
appreciate you could point me to it.


[Platon] Visit the public product page of your switch model:

https://www.nxp.com/products/interfaces/ethernet-/automotive-ethernet-switches:ETHERNET-SWITCHES

The most important document to understand the switch internals is the
Software user manual.

You will also need the documentation of the PHYs installed on your board:

https://www.nxp.com/products/interfaces/ethernet-/automotive-ethernet-phy-transceivers:ETHERNET-TRAN...

 

Best Regards,
Platon

 

 

 

0 Kudos