Author Topic: Fail to Connect to LPC1752  (Read 8264 times)

simonchin

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Fail to Connect to LPC1752
« on: August 15, 2012, 08:34:36 pm »
Hi,
I just get the flash magic production system and minor modify the multiprogrammerARM code to be work on device LPC1752. Somehow it always display unable to connect to device (error -5).
Attach with the code changes:
 
wprintf(L"MultiProgrammer\nPrograms two devices in parallel.\n");

  // program a device using channel 0, COM 1
  channelconfig.channelnum = 0;
 channelconfig.device     = FM_LPC1752; //FM_LPC2378;
...
 channelconfig.channelnum = 1;
  channelconfig.comportnum = 41; //3;
  channelconfig.device     = FM_LPC1752;//FM_LPC2129;
...
// connect
  options.osc            = 12.0000;
  sprintf_s(options.comportname, FM_MAXCOMPORTNAMELEN, "COM%d", channelconfig.comportnum);
  options.baudrate       = 115200; //19200;
  options.selecteddevice = channelconfig.device;
  options.highspeed      = 0;
  options.clocks         = 0;
  options.halfduplex     = 0;
  options.hwconfig       = FM_HWBOOTEXEC;//FM_HWNONE;
  options.hwt1           = 50;//120;
  options.hwt2           = 100;//60;
  options.i2caddr        = 0;
  options.maxbaudrate    = 230400;
  options.usinginterface = 0;
  options.interfacetype  = FM_INTERFACETYPE_NONE;
  options.flashbank      = 0;
.
It is working on flash magic window, refer to pic1.

Pic 2 is the error return back..

regards,



Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Fail to Connect to LPC1752
« Reply #1 on: August 16, 2012, 03:07:52 am »
Did you change the DLL being used from FlashMagicARM.dll to FlashMagicARMCortex.dll?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

simonchin

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Fail to Connect to LPC1752
« Reply #2 on: August 16, 2012, 03:59:17 am »
Hi Andy,

You're right. Different device need to attach with different dll support.

thanks and regards,

simonchin

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Fail to Connect to LPC1752
« Reply #3 on: August 20, 2012, 09:14:16 pm »
Hi Andy,
How do i add the progress % during the each DUT program and display the serial number device on every success program (refer attachment pic)??
Do you hv any examples or link, i'm in learning stage of vc++??
Attach with on going codes. I cannot get back the serial number as show in picture

thanks and regards,







Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Fail to Connect to LPC1752
« Reply #4 on: August 21, 2012, 01:41:11 am »
The progress is passed to program_progress in your code. See the manual for the relevant parameters.

What is the error code being returned when you try to read the serial number?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

simonchin

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Fail to Connect to LPC1752
« Reply #5 on: August 21, 2012, 02:07:33 am »
In debug mode, _fm_serial_number return back hex value of 0x00af207c.
Is it correct?? Or should i do some convertion here?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Fail to Connect to LPC1752
« Reply #6 on: August 21, 2012, 07:54:59 am »
The function returns a pointer to a RESULTS structure. You should access that. Please see the description of the function in the manual.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

simonchin

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Fail to Connect to LPC1752
« Reply #7 on: August 21, 2012, 11:46:22 pm »
Attach with the code & error captured when calling api serial_number.
« Last Edit: August 22, 2012, 01:40:05 am by Andy Ayre »

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Fail to Connect to LPC1752
« Reply #8 on: August 22, 2012, 01:39:41 am »
The only thing I can see you are doing wrong is that results->details is ASCII, not UNICODE, so you have to use printf instead of wprintf. I will email you my working example.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com