Hello,
I want to download the firmware file to my cifX50-RE master using the device driver (Windows XP, driver version 0.9.3.6). I haven't found any example code in the documentation, so I tried the following function call:
lRet = xChannelDownload( DRVhChannel, DOWNLOAD_MODE_FIRMWARE, "cifxecm.nxf", pabFileData, dwFileSize, FwDownCallback, NULL, NULL)
I get the following error code: 0xC02B4353.
The code before, that opens the driver, the communication channel, resets the channel and reads the file content is working (tested with network configuration file download). The firmware download using SYCON is also working.
What have I done wrong? Could anybody provide me a working example code?
thx.
sandmann
Thank you, I found the source code of xSysdeviceDownload() (I think that is the function, I have to use), but nothing of the usage. (I mean the parameters and the function call sequence.) Is it different, than it is for the configuration file download?
I modified my code:
//open driver
lRet = xDriverOpen(&DRVhDriver);
if(CIFX_NO_ERROR != lRet)
{
return lRet;
}
//open sys device
lRet=xSysdeviceOpen(DRVhDriver, "cifX0", &DRVhSysdev);
if(CIFX_NO_ERROR != lRet){
return lRet;
}
//reset sys device
lRet=xSysdeviceReset( DRVhSysdev, 1000);
if(CIFX_NO_ERROR != lRet){
return lRet;
}
//read file
lRet=DRVFileRead(filename);
if(lRet!=EC_NO_ERROR){
return lRet;
}
//download file
lRet = xSysdeviceDownload( DRVhSysdev, 0 , DOWNLOAD_MODE_FIRMWARE, "cifxecm.nxf" , pabFileData, dwFileSize, FwDownCallback, NULL, NULL);
return lRet;
But I keep to get the same error: 0xC02B4353.
I examined the code in the toolkit source files. It seems to me, that I get the error in DEV_DownloadFile() (file cifXDownload.c), right after it sends the first packet using the function pointer pfnTransferPacket(). I haven't found the definition of the error-code anywhere (there is a similar error code mentioned in the netX DPM Interface Manual, but it is 0xC02B4352 - Invalid checksum).
During the download, I get 2 progress callbacks, with the following parameters:
step: 0, maxstep:978116, finished:1, error: 0xC02B4353
step: 978116, maxstep:978116, finished:1, error: 0xC02B4353.
I don't have any idea, what could cause this error. I'm trying to download the EtherCAT master firmware version 2.4(build 3).
thanks for your help:
sandmann
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
the error stands for "TLR_E_RCX_FILE_TRANSFER_TYPE_NOT_AVAILABLE".
please check the channel on which you try to download the file. It must be a communication channel and not any system channel.
Regards
AJ
Does that mean, that I have to use xChannelDownload(), or that xSysdeviceDownload() is to be used with different parameters? I want to download the file to channel 0. I already tried xChannelDownload() with the handle of channel 0 as first parameter, and xSysdeviceDownload() with 0 as second parameter. The retured error was the same in both cases.
Hilscher Gesellschaft fuer Systemautomation mbH
Hi Sandmann,
I am not the C-Toolkit expert, but I think the function "xChannelDownload()" would be the right one.
Regards
AJ
I got the answer from Hilscher support: at the moment the driver doesn't support firmware download from user application, the CifX setup utility should be used. However at Windows startup, the driver downloads the firmware automatically to the card (that is good enough for me).
thx
sandmann
Hello,
I was trying to implement automatic firmware and configuration download using the device driver functions, too. (The intention is to save manual setup time and to perform automatic firmware/configuration updates on series machines).
Unfortunately I did this before I read this post and the device driver documentation is not telling anything about that this does not work on cifX-50 PCI(e) devices. Finding this information earlier would have saved me wasting a bunch of expensive working hours :-(
Up to now, my own cifx library is based on the device driver functions and working quite well. Would be too bad, if I had to change it to work based on the toolkit just to implement this automatic firmware and configuration loading feature...
Does anyone know, whether and when the device driver will ever support this, or how can I implement it based on the device driver functions?
Thanks for any further information about this issue.
Hilscher Gesellschaft fuer Systemautomation mbH
Hello David,
the firmware download is implemented but only for flash memory based devices.
I have an example available, which will use the netXAPI on the cifX device driver.
It is a command line tool.
C:\>nxDrv_Demo.exe
Usage: netXAPI_Demo.exe [path to firmware file] [path to configuration file]
C:\>nxDrv_Demo.exe difxcom.nxf CONFIG.nxd
Driver version: 0.9.0.1
Found Device : cifx0
Device number: 1250100
Serial number: 20294
Hardware options: 0x0080, 0x0080, 0xFFFE, 0xFFFE
Download firmware cifxcom.nxf ...
Download configuration CONFIG.nxd ...
Restart device ...
C:\>
I attached the example. Maybe it will help.
Regards
AJ
Andreas Jacob
Hilscher Gesellschaft fuer Systemautomation mbH
Hi Sandmann,
the requested working example would be the C-Toolkit and the provided example. This is available on the Hilscher web page. CIFX Toolkit (CIFX/COMX/netX)
Regards
AJ