X4M03 bricked?

Discussion in 'X2 & X4 SoC' started by Hammad Tariq, Jul 1, 2017.

  1. Hammad Tariq

    Hammad Tariq New Member


    Today was the first day I started testing X4M03, I installed Atmel Studio 7 for the first time, figured out through XEP documentation how to make it work with ATMEL ICE. The module was working, its LED was changing colors all the time. Then I programmed the distance demo, burned it through the device programmer (if I would press run [the play button on AS7], it would give me an error, however, through device programmer it said the fw is there now and it could verify). Then as I couldn't see anything, I started trying the Python example from another laptop.

    So, here is the setup, my ICE was connected to my Windows laptop and X4M03 was powered by my Mac. So, as I figured out that python example won't need ICE and ATMEL Studio, I tried using Mac's serial interface to run the Python example while X4M03 was also connected with ICE and the other laptop, however, it didn't work (I suppose I was still looking at the correct "alive" com port to connect to) but in the meantime I noticed that the LED of X4M03 is now off.

    I have tried multiple cables and also have tried powering it through wall adapter, no sign of life in there. Was it me or something else happened? Is there any way to fix it?
  2. Hammad Tariq

    Hammad Tariq New Member

    Big sign of relief. I just connected it back to ICE and checked in Device Programming, the signature and device information is there. Why would LED stop blinking?

    Also, if anyone could lead me to the output of the distance demo, that will be great.
  3. Ole-Johan

    Ole-Johan New Member

    Just to be clear: You programmed the X4M03 with this project:

    When you test this demo, you can start by not connecting it to a desktop (except for power), only observe the LED. It should be red, yellow, blue or green depending on how close you are to the sensor. So that will be the first sign that it is running OK. Then we can look at the serial output.

    Could you share which error you get when you press Play in Atmel Studio? Sounds strange...
  4. Hammad Tariq

    Hammad Tariq New Member

    Ok, so I think this is what happened the other day as well. When I write the program, it gives error, the LED keeps blinking but after a while it goes quiet. The error comes at the verification stage and says:

    When this happens, the module also stops appearing at the COM port.
  5. Hammad Tariq

    Hammad Tariq New Member

    I have another problem, after experiencing the above issue, I rewrote the XEP binary and then tried installing ModuleConnector to run python example. It worked on my Mac but on windows, when I run setup.py for pymoduleconnector, it's throwing following error:

    It is also very peculiar because I can see _moduleconnectwrapper sitting right beside __init__.py file in the same folder.
    CCB likes this.
  6. Olav Liseth

    Olav Liseth Administrator Staff Member

    Hamad, make sure that you use the correct python version as described in the documentation:
    • Python 2.7 64 bit
  7. Hammad Tariq

    Hammad Tariq New Member

    Olav, thanks, I will check this, any news about the error with distance demo fw verification problem as I posted above?
  8. I am also experiencing the verification error when using the device programming dialog in the latest Studio 7.0.1417.
    If I uncheck "Erase Flash before programming", and then click the "Erase now" and then the "Program" button it seems to work correctly and verifies successfully.
    I've notified Microchip about the issue. But for now you could either use the workaround or downgrade to a later version; http://www.atmel.com/tools/studioarchive.aspx
    Charlie Shao and Olav Liseth like this.
  9. Faisel Tubbal

    Faisel Tubbal New Member

    Hi Olav,
    Is this means that Python 3.6.3 (Version: Windows x86-64 web-based installer) does not work with X4M03?
  10. Olav Liseth

    Olav Liseth Administrator Staff Member

    Hi Faisel,

    Module Connector comes with Python 3.6 support since V1.4.0.

  11. Faisel Tubbal

    Faisel Tubbal New Member

    Hi Olav,
    Thanks for your reply,

    Why I am trying to setup python API, I got the following error. What do you recommend.


  12. Olav Liseth

    Olav Liseth Administrator Staff Member

    Hi Faisal,

    Seems like you are using the wrong device name, you can either open device manager -> Ports and find the com port listed as Bossa Program Port or you can use Module Connector:

    Please note that only the XEP examples supports the X4M03 device.

  13. Faisel Tubbal

    Faisel Tubbal New Member

    Thanks heaps Olav, That helped a lot .. It is working now.


    but when I tried adding -r and -f (C:\Users\Faisel Tubbal\Anaconda3) C:\Users\Faisel Tubbal\ModuleConnector-win32_win64-1.4.3\python36-win64\pymoduleconnector\examples>python XEP_plot_record_playback.py -d COM4 -r)
    it gave me the following error

    for -b was okay.

  14. CCB

    CCB New Member

    I'm having this error on raspberry pi, and I've spent several hours troubleshooting every level of the installation. Same repro for python27 and python35. From what I can tell, swig might have a circular dependency?

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/pi/Documents/python34-arm-linux-gnueabihf/pymoduleconnector/__init__.py", line 2, in <module>
    from .moduleconnectorwrapper import DataReader
    File "/home/pi/Documents/python34-arm-linux-gnueabihf/pymoduleconnector/moduleconnector.py". line 5, in <module>
    from .moduleconnectorwrapper import \
    File "/home/pi/Documents/python34-arm-linux-gnueabihf/pymoduleconnectorwrapper/__init__.py". line 28, in <module>
    _moduleconnectorwrapper = swig_import_helper()
    File "/home/pi/Documents/python34-arm-linux-gnuabihf/pymoduleconnector/moduleconnectorwrapper/__init__.py", line 20, in swig_import_helper
    import _moduleconnectorwrapper
    ImportError: No module named '_moduleconnectorwrapper'

    Would appreciate any help. I've tried this on OSX as well, and run into a different issue in that env:

    ImportError: dlopen(/usr/local/lib/python3.6/site-packages/pymoduleconnector-1.4.3-py3.6.egg/pymoduleconnector/moduleconnectorwrapper/_moduleconnectorwrapper.so, 2): no suitable image found. Did find:
    /usr/local/lib/python3.6/site-packages/pymoduleconnector-1.4.3-py3.6.egg/pymoduleconnector/moduleconnectorwrapper/_moduleconnectorwrapper.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03

    I'd be very happy if either environment decided to cooperate.
    Last edited: Apr 5, 2018
  15. Charlie Shao

    Charlie Shao Moderator Staff Member

    Hi CBB,
    I just did a tested on Respbian jessie, it works well on both python2.7 and python3.4. Raspbian stretch should also work.
    Instead of spend time debugging this fault, are you able to try on a purely clean Respbian system?
    Here are my suggested steps:
    1. reinstall latest Raspbian stretch and update.
    2. download ModuleConnector-rpi-1.4.3
    3. check python version "python -v" or "python3 -v"
    4. run "sudo python setup.py install" or "sudo python3 setup.py install"
    Let's see if this error happens again or not.
    CCB likes this.
  16. Charlie Shao

    Charlie Shao Moderator Staff Member

    I did a test this morning on Raspbian stretch, the python27 examples work well (need to run sudo apt-get install python-matplotlib to install matplot library), but the python34 examples do not work with python3.5.


    Hi Charlie,
    Don't you think that it is useful to have isolated environments in RPI (virtualenv installed) ?
    Charlie Shao likes this.
  18. aoxiang

    aoxiang New Member

    Traceback (most recent call last):
    File "upgrade_firmware.py", line 2, in <module>
    from pymoduleconnector import ModuleConnector
    ImportError: No module named pymoduleconnector
    I can't find the pymoduleconnector, how can I solve it?
  19. Charlie Shao

    Charlie Shao Moderator Staff Member

    You need to install ModuleConnector on your host, or failed installation cause this problem.