• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NetHAT SPI configuration

I want to use the NetHAT via a non linux embedded environment. I'm using the M4 processor of the STM32MP157C-DK2 board.
I didn't think it would be too difficult knowing that the netShield which uses the same netX52 works with stm32 nucleo boards
The netHAT has EtherCAT firmware already loaded from linux
For the SPI configuration I used the exact same code from one of the samples along with cifxToolkit taken from "STM32CubeExpansion_netX_F7_F4_V1.3.0.1" file on your website for the netShield
SpiHandle.Instance               = SPIx;
SpiHandle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
SpiHandle.Init.Direction         = SPI_DIRECTION_2LINES;
SpiHandle.Init.CLKPhase          = SPI_PHASE_2EDGE;
SpiHandle.Init.CLKPolarity       = SPI_POLARITY_HIGH;
SpiHandle.Init.DataSize          = SPI_DATASIZE_8BIT;
SpiHandle.Init.FirstBit          = SPI_FIRSTBIT_MSB;
SpiHandle.Init.TIMode            = SPI_TIMODE_DISABLE;
SpiHandle.Init.CRCCalculation    = SPI_CRCCALCULATION_DISABLE;
SpiHandle.Init.CRCPolynomial     = 7;
SpiHandle.Init.NSS               = SPI_NSS_SOFT;
SpiHandle.Init.Mode              = SPI_MODE_MASTER;

With this configuration I'm receiving bytes backward, and shifted one bit and with 0xFF between each byte.
When I set CLKPhase to SPI_PHASE_1EDGE, I'm receiving the bytes, shifted one bit to left and 0xFF between each byte
Here is a picture that illustrates the problem:
[Image: 9YfCYNH.png]
The spi is configured to 50mhz.
I have tried all combinations of CLKPhase and CLKPolarity and none works as it should.
Does the netHat have a different configuration for SPI than the netShield ? Because the configuration from the sample you provided for the netShield doesn't seem to work on the netHat
Can I get more information about how the netHat spi is configured and how should I configure my master spi correctly ?

Thank you
The netX52 chip and firmware works always the same independent if it is assembled on netSHIELD or netHAT product so there can't be any difference.

I personally don't know the netSHIELD product and have never worked with it since the type of product is mainainted by our netX development team over their own web sites here https://www.netiot.com/interface/netshield/ and here https://kb.hilscher.com/x/MQNBB.

I would recommand to read more details about the netX52 chip itself here: https://kb.hilscher.com/display/NETX/netX+52. There you find any information like all official customer that buy netX52 in thousands or pieces

Basically I want to mention that SPI supports 4 modes as described here https://www.allaboutcircuits.com/technic...interface/. I just can tell you that on RPi3 units our host driver always uses SPI mode 0 as configured in the driver config file \opt\cifx\plugins\netx-spm\config0 file. I expect you need to use the very same mode on your ST chip as well.

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)


Possibly Related Threads…
Thread Author Replies Views Last Post
  netHat ProfiNet Tia Portal Error Mario13 1 568 October-24th-2022, 06:06 AM
Last Post: Armin@netPI
  netHat on Profinet with TIA Portal michela.limaco 12 1,472 August-26th-2022, 02:57 PM
Last Post: michela.limaco
  NetHat + Ethernet/IP + APIs or SDKs michela.limaco 4 1,940 October-11th-2021, 01:05 PM
Last Post: michela.limaco
  Pi + netHAT + NodeRed + EtherCAT effendi 1 2,430 August-19th-2021, 09:52 AM
Last Post: Armin@netPI
  Using Powerlink firmware with netHAT and config nxd thp9 3 4,863 August-25th-2020, 01:49 PM
Last Post: Armin@netPI
  How can i set a EtherCAT node in netHAT 52-RTE? JGLee 6 6,617 June-9th-2020, 12:38 PM
Last Post: Armin@netPI
  cifX drivers EtherCAT read/write performance with NetHat over STM32 thp9 21 11,313 June-5th-2020, 10:17 AM
Last Post: Armin@netPI
  netHAT as Ethernet/IP Adapter with Codesys lstiegler 11 8,641 May-26th-2020, 06:40 PM
Last Post: Armin@netPI
  netHat configuration via config packets pitau 6 5,976 May-25th-2020, 02:21 PM
Last Post: Armin@netPI
  NetHAT temperature question thp9 1 4,740 May-14th-2020, 09:21 PM
Last Post: Armin@netPI

Forum Jump:

Users browsing this thread: 1 Guest(s)