Flash Magic Forum

In-System Programming Support => General => Topic started by: JamesM on June 23, 2020, 11:33:11 AM

Title: Unsupported Operation?
Post by: JamesM on June 23, 2020, 11:33:11 AM
I am using C++ Builder XE6. I have linked with the Borland C++ 5 DLLs. However, when I run the following code, fm_connect returns "Device does not support operation. Only COM connections supported."

I must be missing something obvious? Thank you in advance for any help - James



#include "flashmagicarmcortex.h"

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  fm_results *presults;
  presults = fm_version();

  fm_connectoptions_com options;

  fm_set_default_timeouts();

  options.osc               = 12.000;
  sprintf_s(options.comportname, FM_MAXCOMPORTNAMELEN, "COM%d", 5);
  options.baudrate          = 115200;
  options.selecteddevice    = FM_LPC1758;
  options.highspeed         = 0;  //1;
  options.clocks            = 0;
  options.halfduplex        = 0;
  options.hwconfig          = FM_HWBOOTEXEC;
  options.hwt1              = 200;
  options.hwt2              = 200;
  options.i2caddr           = 0;
  options.maxbaudrate       = 115200;
  options.usinginterface    = 0;
  options.interfacetype     = FM_INTERFACETYPE_NONE;
  options.flashbank         = 0;
  options.protocoloptions   = FM_PROTOCOLCOM_AUTOLF;
  options.postopendelay     = 0;
  options.bootloaderpath[0] = NULL;

  presults = fm_connect(&options, sizeof(options));

  if (presults->result != FM_OK)
ShowMessage(presults->details);
}
Title: Re: Unsupported Operation?
Post by: Andy Ayre on June 23, 2020, 12:25:01 PM
I don't know which version you are using, however:

Use the Microsoft DLLs
Use implib to generate Borland-compatible lib files from the Microsoft DLLs
Make sure the header files and the DLLs come from the same version.

Please post back if that does not help.

Andy
Title: Re: Unsupported Operation?
Post by: JamesM on June 23, 2020, 03:28:14 PM
Thank You Andy - That works fine