How to set slave address while application run time?

Hi Team,

We are purchased anybus modules (Ethernet IP,Devicenet and Profibus) for my project, Data receiving as per ADI mapping via SPI communication, I am unable to set Slave address while application run time, I configured below functions to set slave address. Please provide some solution to set slave address.

ABCC_SYS_HWReset();
ABCC_SYS_HWReleaseReset();
APPL_SetAddress(7);

Regards,
Naveen.

Hi @Naveen,

Are these Anybus CompactCom modules or are these gateways? If it’s the CompactCom devices we’re trying to move those to mysupport.hms.se instead of hms.how for ticket escalation purposes.

-Tim

Hi TIM,

Yes, We are using Anybus CompactCom module (Ethernet IP,Devicenet and Profibus), I am trying set slave address for CompactCom module from source code in run time, Testing with Simulators.

Thanks & Regards,
Naveen.

Hi @Naveen,

We can help you out here, but because of the time difference it may be difficult and we’d recommend that you go through https://mysupport.hms.se

Which simulators are you using?

Hi Tim,

Thank you for reply,

Currently we are using Profibus and Devicenet master simulator, I am able to setting slave address in boot time (First application launch time),Data receiving from brick to master simulator as per configured ADI mapping, While run time need to change the slave address from source code, I am using below steps to configure slave address in run time.

ABCC_SYS_HWReset();
ABCC_SYS_HWReleaseReset();
APPL_SetAddress(7);

Regards,
Naveen.

With Ethernet/IP are you writing to the Node address?

Dear Time,

Thanks for technical support,

I am not setting Node address from Ethernet IP, I am trying to set Devicenet Slave address from Host application, How can i update attributes from host application, I got only these API’s to set slave address and any other API should i call in tun time to set slave address ?

Thanks and Regards,
Naveen

Hi Naveen,

After talking to my colleague on this it looks like the calls that you’re making for the reset then reset release and setting the address should be fine. You might be running into a timing issue though if there’s not enough time for the reset to complete. Can you let us know what the device is doing after you run this command? Do the LEDs seem to be doing anything different after this reset?

Dear Tim,

Thanks for the reply,

Currently 1m seconds delay after set and reset GPIO pin in host application code, I changed different delays but not working, Initial boot slave address is set and data transmitted and two LED’s (NS and MS) both are turn ON (Green), after set slave address two LED’s are turn OFF.

Thanks and Regards,
Naveen.

From the way that the LEDs are behaving after the command is set, it sounds like the device is having a timing issue and it’s not having enough time to initialize after you try to set the slave. Do you have a Saleae logic analyzer that you could use on the device to get us some log files on what this device is doing?

Dear Tim,

Currently we dont have Saleae logic analyzer, any other method to debug the code and this issue from long days, I raised ticket as you mention forum but no response, Host application source code working as per HMS, I did not changed anything in this code, I calling default function to update the slave address, What is the solution for this issue. Thanks for technical support.

Regards,
Naveen.

Do you have a serial port? you could get do some print statements to our debugger to try and get some logs about what’s happening with this device.

Could you give us a copy of your code or tell us where in the code you’re using:

ABCC_SYS_HWReset();
ABCC_SYS_HWReleaseReset();
APPL_SetAddress(7);

Are you setting the device to initialize after you make that reset command? If you are then it may be a timing issue that’s going on but you’ll need something like the Saleae analyzer or a scope to show whether or not the timing is correct for these.

One thing that may help with the timing issue would be to put in a delay between the reset and the reset release routines. The minimum required time between the reset and release is 10us

image

There appears to also be a minimum delay time from when the 3V3 rail stabalizes and allows the release of the ABCC from reset.

APPL_ABCCRESET may be more useful for what you’re trying to do in this case because it does put the device back in init mode afterward

case APPL_ABCCRESET:

  ABCC_HWReset();
  appl_eAbccHandlerState = APPL_INIT;
  eModuleStatus = APPL_MODULE_NO_ERROR;
  break;

Hi Tim,

Thanks for the technical support,

I am able to set slave address while host application run time by using below code. tested multiple times and working as expected. Please can you conform this is the right way to update the slave address. Yes we have serial port to debug the code with print statement. Anybus Generic host application using for development, uploaded code only integrated with my QT source code, Please check the attached code for reference.AnybusGeneric_HmsSupport.zip (677.9 KB)

slaveAddressUpdate(7);
APPL_RestartAbcc();

  • slaveAddressUpdate function using to update appl_bNwNodeAddress form host application code (appl_abcc_handler.cpp)
    void slaveAddressUpdate(int slaveAddress)
    {
    appl_bNwNodeAddress = slaveAddress;
    }

Regards,
Naveen.

That should be fine, APPL_Reset will end up calling the function APPL_RestartAbcc() as well but I’d say that should be fine. It looks like the code you were using before was just having issues because it wasn’t able to initialize before. But now that you’re calling that restart function, I believe it should be ok

Hi Tim,

Thanks for the conformation and technical support.

Regards,
Naveen.