Problem running host application for M40 module

Hello,

I have a problem with the Anybus CompactCom M40 Profinet with my PIC18LF26K42 as Host using SPI communication. The application sends MOSI message, but the response of the Anybus does not seem to match expectations.

My configuration: I have connected the Anybus CompactCom M40 to the Anybus Extension Board from the Starter Kit and an external PIC processor. I am using the Generic code of the Anybus Host Application Example Code.
I have followed the Host Application Implementation Guide to configure the code and I am on Step 1 trying to get the run state…
When powering on the device, the module status LED is OFF and it remains OFF.

The MOSI frame is present on the line, verified with oscilloscope and logic analyzer.
The timings of the signal are like in Hardware Designe Guide.
SPI frequency is 200 kHz, I’ve tried with otehr frequencies with no results.
On the MISO line there is always zero, not responce from the Anybus M40 module.

Thanks for your help.

Hello,
I will start of saying this Support forum is run by a team in the US and I encourage you to reach out to your local support team via mysupport.hms.se.
I recommending reviewing the hardware design guide to make sure you have the device wired up correctly. Are you sure the Operating mode pins are set correctly? Do you have a pull down resistor for the reset line?

Have you made the appropriate changes to the Generic Host Application to work with your PIC?

Deryck

Hi,
the operating mode pins are connected in this way:
OM0 - +3.3V
OM1 - GND
OM2 - GND
OM3 - Grounded with 1 k resistor

I have a 1k resistor pull down on RESET line

I’ve followed the Host Application Implementation Guide and all seems to work properly, but I have no green LED lighted and no bits on the MISO line.

How are you monitoring the SPI bus? Do you have a Saleae logic analyzer? We have a pluging that he helpful for this. https://github.com/hms-networks/AbccSpiAnalyzer

I’ve monitored the SPI in 3 ways:

  • monitoring the value readed by the MCU in debug
  • tested with an oscilloscope
  • tested with logic analyzer with Saleae software with and without your plugin

In all cases I have the same result:

  • MOSI line outputs the bytes supplied by HMS driver
  • MISO line seem to be dead, no signal, all bits are 0

Hello @wolf041,

Are you pulling the IRQ high on startup?

Is everything connected as shown in section A.6?

Deryck

Hi deryck,
it’s all connected like in the diagram.
The IRQ is not connected to the host, like described in the Host Application Implementation guide.

I’ve verified with oscilloscope and the IRQ goes high at startup, then is always low.

Do you have any issues using the module in the starter kit? Can you provide a photo of you setup perhaps I will spot something out of place.

Deryck

Using the module with the starter kit board works fine.

This is my setup

Hello,

It is hard to say what else would be going wrong here. Nothing looks obviously out of place in the pictures. Are you seeing power at the power pins on the M40?

image

Deryck

Hi Deryck,
yes, there is voltage on power pins.

A colleague of mine took a look at this topic. A capture showing the ABCC reset, SPI Clock, SPI MISO/MOSI, and SPI chipselect might give us a better idea of what is going on.

He had a similar concern as me thinking the there could be a power issues and you might be seeing brownouts. A scope capture of the 3v3 and reset might show this happening.

Did you test SPI mode with the starter kit? Perhaps something happened to damage this part of the chip.

Deryck

Hi Deryck,
I’ve solved the problem.
I’ve connected the SPI in 4 wire mode and now it works fine.
I’ve not understood why in 3 wire it doesn’t works, but I have no problem to work with SS signal.

Thanks for your help.

1 Like

Glad to hear it is working!

@wolf041,

Do you know what clock sped you were using? For 3 wire there is a minimum SPI clock of 100kHz. You might have been using a speed to low.
You might also have been toggling the SS pin after the CompactCom was pulled out of reset.

Deryck

Hello,

Can you share the code for the PIC18LF26K42?

Thanks for your help

This would have to come from @wolf041. The starter kit includes examples for Freescale, Linux Xilinx_arm, and STM32.

Deryck