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

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
Projects\STM32F429ZI-Nucleo\Applications\netX\Common\Src\main.c:
Code:
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
  Reply
#2
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.

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

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Powerlink firmware with netHAT and config nxd thp9 3 493 August-25th-2020, 01:49 PM
Last Post: Armin@netPI
  How can i set a EtherCAT node in netHAT 52-RTE? JGLee 6 838 June-9th-2020, 12:38 PM
Last Post: Armin@netPI
  cifX drivers EtherCAT read/write performance with NetHat over STM32 thp9 21 1,239 June-5th-2020, 10:17 AM
Last Post: Armin@netPI
  netHAT as Ethernet/IP Adapter with Codesys lstiegler 11 1,034 May-26th-2020, 06:40 PM
Last Post: Armin@netPI
  netHat configuration via config packets pitau 6 699 May-25th-2020, 02:21 PM
Last Post: Armin@netPI
  NetHAT temperature question thp9 1 630 May-14th-2020, 09:21 PM
Last Post: Armin@netPI
  Using netHAT drivers with custom linux (not Raspbian) FrankS 5 721 September-11th-2019, 06:16 AM
Last Post: Armin@netPI
  Use netPi firmware on netHAT zz_zesys 1 944 September-30th-2018, 08:04 PM
Last Post: Armin@netPI
  NetHat Labview richielfc 1 765 August-10th-2018, 12:08 PM
Last Post: Simon@netHAT
  Problem with NetHAT Configuration adeeljsid 2 613 July-5th-2018, 12:10 PM
Last Post: Simon@netHAT

Forum Jump:


Users browsing this thread: 1 Guest(s)