SJA1110 SDK for the hardware GLDBOX

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

SJA1110 SDK for the hardware GLDBOX

932 Views
yangjinzhuang
Contributor IV

Hello,

        I have hardware S32G-VPN-GLDBOX, it's software version is Linux-BSP39.0, the switch chip is SJA1110, I have two questions as follow:

       1、How can I set spi mode to SPI_AP? It is on SPI_HOST mode as default in my understand.

       2、What is the difference between SWITCH_CONTROL_SPI  and SWITCH_CONTROL_INTERNAL in the SJA1110 SDK? I understand that the SWITCH_CONTROL_INTERNAL is SPI_HOST and the SWITCH_CONTROL_SPI  is the SPI_AP, is it right? 

typedef enum
{
SWITCH_CONTROL_SPI = 1, /**< Switch connected via SPI interface */
SWITCH_CONTROL_INTERNAL = 0 /**< Switch is internal/reachable via register access */
} switch_control_t;

 

     

Labels (1)
0 Kudos
Reply
11 Replies

907 Views
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

SPI_HOST internally connects to the microcontroller subsystem and is used to control the processor boot, e.g. to provide a firmware image for boot or to update the flash.

The SPI_AP controller offers a memory-mapped IO access into the device which allows to control switch and some peripherals from an external microcontroller.

SPI_AP and SPI_HOST share the same SPI pins, distinguished by pins SS0_N and SS1_N. So, you select SPI_AP by pulling SPI_HAP_SS0_N low (it is connected to the pin PB_14/LLCE_LPSPI2_PCS0/I2C3_SCL/RCON21 of S32G399).
Please refer to UM11107 chapter 2 Device access for more details.

SWITCH_CONTROL_SPI and SWITCH_CONTROL_INTERNAL tell firmware of the internal M7 where the switchcore is connected:

  • SWITCH_CONTROL_INTERNAL means switchcore (or microcontroller subsystem) in the same silicon
  • SWITCH_CONTROL_SPI means switchcore (or microcontroller subsystem) in another SJA1110 connected in cascade via SPI_PER to SPI_HAP of another SJA1110. You may refer to design of SJA1110 EVM board for details.

Best regards,

Pavel

0 Kudos
Reply

877 Views
yangjinzhuang
Contributor IV

Hello,

       Thanks for your reply, I can clearly understand SWITCH_CONTROL_INTERNAL and SWITCH_CONTROL_SPI, I have  two questions as follow:

        1、How to pulling SPI_HAP_SS0_N low (it is connected to the pin PB_14/LLCE_LPSPI2_PCS0/I2C3_SCL/RCON21 of S32G399) to select SPI_AP?

            Does GLDBOX have a jumper design to achieve the function of pulling SPI_HAP_SS0_N low?

        2、in my understand that I can visit SJA1110'registers from an external microcontroller(s32g274A's A core) through SPI on SWITCH_CONTROL_SPI mode, is it right or not?

0 Kudos
Reply

858 Views
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

ad 1. SDK function readMMD and writeMMD shall help you. The example shall be configured in a way, that SPI_HAP_SS0_N is pulled down automatically by using SPI.

No, there's no jumper or anything in the Goldbox HW.

ad 2. Yes, that's right.

Best regards,

Pavel

0 Kudos
Reply

717 Views
yangjinzhuang
Contributor IV

Hello,

        I still don't know how to select  SPI_HAP_SS0_N to set SPI_AP, with your response "SDK function readMMD and writeMMD shall help you. The example shall be configured in a way, that SPI_HAP_SS0_N is pulled down automatically by using SPI." I find that the  readMMD and writeMMD are the phy driver interface, I don't think it is for SPI_HAP_SSx.

       I can see that in the SDK: pin_spihapss's  ss0 and ss1 are as follow

yangjinzhuang_0-1731480940202.png

I can also see that the spihapss's interface is ACU_SJA1110_setCfgPinSpiHapSs(), it is called only in the PINS_SJA1110_DRV_Init() process to init as ACU_SJA11XX_pinInputStageSelection_PULL_UP.

yangjinzhuang_1-1731481166433.png

 

Can you tell me how to set SPI_HAP_SSx to SPI_HAP_SS0 to select SPI_AP?

Thank you very much!

 

0 Kudos
Reply

564 Views
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

those ACU routines are relevant for internal SJA1110's M7 core to access the other SJA1110 switch in cascaded mode.

SPI_HAP is connected to DSPI5 on your Goldbox. There's a note that SPI_HAP_SS0_N is connected to the GPIO30. Unfortunately, I don't know details about S32G.

I also posted answer to your another thread: SJA1110 configuration and SPI command - NXP Community

Best regards,

Pavel

0 Kudos
Reply

554 Views
yangjinzhuang
Contributor IV

Hello,

        Thanks for your reply, I  find that as follows. I can understand that SPI_HAP_SSX is pulling low by S32G274A. 

yangjinzhuang_0-1732155220327.png

      As I understand that, by default, SJA1110 is SPI_HOST, so DSPI5_PCS0 is pulling low. Now I should pulling low SJA_SPI_SS0_N  by GPIO30, right?  Maybe there are register read/write API

in Linux spi driver now, I don't need to change SPI_HOST/SPI_AP on SJA1110, I am not sure, can you help me to understand that,  thank you!

0 Kudos
Reply

455 Views
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

I really apologize for late response. I focus mainly to ethernet support. I do not know how to setup linux BSP to be able to send messages via SPI5 to SJA1110. I did some research but I've not succeeded yet.

To speed up your issue, please create a question to S32G community.

I apologize for any inconvenience.

Best regards,

Pavel

0 Kudos
Reply

845 Views
yangjinzhuang
Contributor IV

Hello,

        I want to use S32G274A as the external microcontroller to control SJA1110, first I need to config SPI_HAP_SS0_N  to select SPI_AP, second do I need to set SWITCH_CONTROL_SPI mode in SDK? 

        Does any work exit on S32G274A, for example spi or sja1110's driver to set for SPI_AP communication with SJA1110?

0 Kudos
Reply

826 Views
yangjinzhuang
Contributor IV

Hello,

      I'm sorry, but in your latest reply, I still don't understand clearly how to correctly set the switch-control-type:

      Your latest reply is that: If you are developing firmware for SJA1110's internal M7, SWITCH_CONTROL_INTERNAL shall be set. If you are developing firmware for SJA1110's internal M7 to access external switchcore (cascaded SJA1110), SWITH_CONTROL_SPI shall be used.

      How to correctly set the switch-control-type in SJA1110 SDK in the following scenarios:

           S32G274A(role:master)---(SPI link)---SJA1110(role:slave; mode:SPI_AP)

                                                                                                         |

                                                                          (SWITCH_CONTROL_INTERNAL or SWITH_CONTROL_SPI )

      Note: S32G274A is external microcontroller, SJA1110 is set SPI_HAP_SS0_N

 

0 Kudos
Reply

804 Views
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

generally speaking, you need dedicated S32DS project for each device.

In the SJA1110 project, the switchcore will be configured as SWITCH_CONTROL_INTERNAL. Please refer to the example project switch_config_s32g_vnp_rdb. Based on S32G-VNP-RDB2 Reference Design Ethernet Enablement Guide, you can flash the image to SJA1110's NVM or load to the SD card...

The S32G2 is another story. There's running linux BSP. SJA1110 is connected to SPI5. You may refer to autoivnsw_sja1110_linux/README.md at master · nxp-archive/autoivnsw_sja1110_linux · GitHub for details regarding the linux driver. There are several docs on page GoldBox for Vehicle Networking Development Platform | NXP Semiconductors, like NXP GoldBox for Vehicle Networking Software Enablement Guide.

Best regards,

Pavel

0 Kudos
Reply

748 Views
yangjinzhuang
Contributor IV

Hello,

       I have reviewed the documents for S32G and SJA1110 mentioned above, but I have not found an answer. According to your previous response, SJA1110 supports being controlled by an external controller S32G274A in SPI_AP mode, similar to one SJA1110 controlling another SJA1110. Based on my understanding, I would like to know what is the switch-control-type in the SJA1110 SDK when using SPI_AP to control the SJA1110 in the S32G274A scenario?

0 Kudos
Reply