GithubHelp home page GithubHelp logo

Comments (15)

saeugetier avatar saeugetier commented on June 17, 2024 1

Solution would be that on 64bit windows systems not JLinkARM.dll should be used. Please use JLink_x64.dll

The code could look something like that:
`WINDOWS32_JLINK_SDK_NAME = 'JLinkARM'
WINDOWS64_JLINK_SDK_NAME = 'JLink_x64'

if platform.architecture()[0]=='32bit':
        WINDOWS_JLINK_SDK_NAME = WINDOWS32_JLINK_SDK_NAME
elif platform.architecture()[0]=='64bit':
     WINDOWS_JLINK_SDK_NAME = WINDOWS64_JLINK_SDK_NAME`

from pylink.

rils avatar rils commented on June 17, 2024

I understood the problem. My PC is running on 64bit Win7 OS. SO I selected 64bit python version 3.6. But the JlinkARM.Dll is for 32bit. So python could not load it. I uninstalled python and installed 32bit version. Now Everything works good.! Thanks.

from pylink.

zamora18 avatar zamora18 commented on June 17, 2024

@saeugetier what I did was alter the file in pylink/library.py and changed line 87 to:

WINDOWS_JLINK_SDK_NAME = 'JLink_x64'

As of now it is working fine, and it eliminated the OSError: [WinError 193] %1 is not a valid Win32 application error, but I want to know if this is acceptable? I don't want it to cause problems later on.

from pylink.

hkpeprah avatar hkpeprah commented on June 17, 2024

Ah, interesting. This was an oversight on our part. If you want to submit a patch for this, that would be great!

from pylink.

saeugetier avatar saeugetier commented on June 17, 2024

@zamora18 yes, you can do this. But then the code will only run on a 64bit system.

from pylink.

zamora18 avatar zamora18 commented on June 17, 2024

I think @saeugetier's addition to select between 32-bit and 64-bit systems would be a good solution.

I am not sure if this error is related to my change, but I get this output:

No handlers could be found for logger "pylink.jlink"
Traceback (most recent call last):
  File "C:/Users/zamora/PycharmProjects/jflash/my_flash_test.py", line 20, in <module>
    jlink.connect("STM32F446RE", verbose=True)
  File "C:\Users\zamora\PycharmProjects\jflash\pylink\jlink.py", line 141, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\zamora\PycharmProjects\jflash\pylink\jlink.py", line 912, in connect
    raise errors.JLinkException(result)
pylink.errors.JLinkException: Unspecified error.

I have been trying to trace the error, because Unspecified error is not very clear.
The last portion of the error occurs after this call in jlink.py:

result = self._dll.JLINKARM_Connect()
        if result < 0:
            raise errors.JLinkException(result)

I can't tell if it is actually looking for JLINKARM still since I changed to JLINK_x64? Could you help me with this? Thank you.

from pylink.

hkpeprah avatar hkpeprah commented on June 17, 2024

There's some documentation here around this error: http://pylink.readthedocs.io/en/latest/troubleshooting.html

It's a generic catch-all.

from pylink.

zamora18 avatar zamora18 commented on June 17, 2024

Thank you, I looked over those errors, and in my case I am attempting to connect to the target when it fails. I believe I may be "trying to connect to the target over JTAG when it only supports SWD".

However, in the documentation, it states that I need to be connected to the target before I can call swo_start(). I double-checked the other possible diagnoses for my error and it does not seem to be any of them.
It has been difficult to diagnose because I have used the J-Link JFlash software and it connects & programs just fine (see image). One more detail to note, is that I have gotten my python script to work, but it is very seldom and sporadic. What I usually try to do is use the J-Flash utility and erase the chip multiple times, and power cycle the device over and over.

I really appreciate any help.

image

from pylink.

hkpeprah avatar hkpeprah commented on June 17, 2024

swo_start is for using Serial-Wire Output (SWO), you don't want to use it here (unless you want to do SWO stuff as well). You want to connect over SWD:

jlink = pylink.JLink()
jlink.open()
jlink.set_tif(JLinkInterfaces.SWD)
jlink.connect('STM32F446RE')

You can then call swo_start() to use SWO.

from pylink.

zamora18 avatar zamora18 commented on June 17, 2024

Using jlink.set_tif(pylink.JLinkInterfaces.SWD) worked!

Thank you for your help!

from pylink.

zamora18 avatar zamora18 commented on June 17, 2024

I am setting up a new machine and am still getting this same error on 64-bit.

from pylink.

zamora18 avatar zamora18 commented on June 17, 2024

@hkpeprah This PR does fix my issue and I no longer get the OSError: [WinError 193] %1 is not a valid Win32 application error message.

from pylink.

TiagoSousa26 avatar TiagoSousa26 commented on June 17, 2024

I am still getting this error. It seems to not be fixed :(

from pylink.

 avatar commented on June 17, 2024

File "", line 1, in

File "c:\users\yv999fy\onedrive - ey\documents\aflac_wwhq\model results\output_total\Compare.py", line 370, in compare_care

import xlwings as xw

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\xlwings_init_.py", line 9, in

from . import _xlwindows as xlplatform

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\xlwings_xlwindows.py", line 25, in

from comtypes import IUnknown

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes_init_.py", line 1176, in

class IPersist(IUnknown):

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes_init_.py", line 1181, in IPersist

( ['out'], POINTER(GUID), 'pClassID' )),

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes_init_.py", line 1099, in COMMETHOD

from comtypes.automation import VARIANT

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes\automation.py", line 12, in

from comtypes import npsupport

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\comtypes\npsupport.py", line 5, in

import numpy

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\numpy_init_.py", line 140, in

from . import _distributor_init

File "C:\Users\YV999FY\AppData\Roaming\Python\Python37\site-packages\numpy_distributor_init.py", line 26, in

WinDLL(os.path.abspath(filename))

File "C:\Users\YV999FY\Anaconda3\lib\ctypes_init_.py", line 364, in init

self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 is not a valid Win32 application

Can someone help with this??

from pylink.

hkpeprah avatar hkpeprah commented on June 17, 2024

Can someone help with this??

@jjaredrides I would open a new issue for different/new questions. That being said, the issue is likely that you're using a 32-bit Python, but 64-bit application. I would ensure you're using the 64-bit Python.

from pylink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.