1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[solved] mimas v2 programming in linux...

Discussion in 'FPGA Boards' started by joefitz, Mar 31, 2015.

  1. Evert Rozendaal

    Evert Rozendaal New Member

    Joined:
    Apr 26, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Roanoke,VA USA
    Turned out there is yet an other reason to hate windows 8. After installing everything on windows 8 I keep on getting a message about the license but it turned out to a problem with windows 8 since it is not supported. Have not installed python 3 yet but hope to have some time soon.

    Thanks.
     
  2. cyrozap

    cyrozap Moderator

    Joined:
    Apr 12, 2015
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    USA
    Are you sure it's a Windows issue? I haven't had any problems running ISE on Windows 8.1.
     
  3. Evert Rozendaal

    Evert Rozendaal New Member

    Joined:
    Apr 26, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Roanoke,VA USA
    I got a message saying that _pn.exe crashed. After doing a search I found:
    http://forums.xilinx.com/t5/Install...tall-on-Windows-8-1-giving-pn-exe/td-p/510515

    I have not tried the fix for windows 8 yet but if I can get the python script up an running on ubuntu I will keep on using ubuntu for a while. Now I am just using windows for loading the FPGA.

    Just trying to get more FPGA programming experience so I can put that on my resume too. Living alone and in a boring city it should not take that long :)
     
  4. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    We routinely see ISE and other Xilinx tools crash when used with Windows 8.1. The following suggestion from one of the threads on Xilinx forum always helped.

    Please see the original thread at http://forums.xilinx.com/t5/Install...tall-on-Windows-8-1-giving-pn-exe/td-p/510515

    Thanks,
    Tom
     
  5. Julio Torres

    Julio Torres New Member

    Joined:
    Apr 29, 2015
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Quito, Ecuador
    Hello. I've just got a MimasV2, and I'm also having the issue stated in the first comment:

    Code:
    ****************************************
    * Numato Lab Mimas V2 Configuration Tool *
    ****************************************
    Unable to read SPI Flash ID
    I'm using Linux Mint 17 and Python 3.

    Did you get to fix it?

    Thanks,

    Julio
     
  6. Evert Rozendaal

    Evert Rozendaal New Member

    Joined:
    Apr 26, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Roanoke,VA USA
    Just got my windows 8 problem fixed. Copying the DLL's did the trick. Thanks Tom.

    Install Python 3 on my ubuntu system but still have the same problem as Julio. I have been using my windows 8 system for loading the flash.

    Thanks,
    Evert
     
  7. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Evert, Happy to hear that the Xilinx ISE issues are fixed.

    Evert/Julio,

    The Python script that was shared was not written with Linux in mind at all. When Joe asked for the script I just shared it with the hope that the users may be able to make some changes to make it work with Linux. I tested the script on Centos with minor changes and it worked for me. But it is practically difficult for us to test it on all platforms. I would recommend everyone to give Centos/Redhat a try (login as root for test) instead of Mint.

    Thanks,
    Tom
     
  8. Julio Torres

    Julio Torres New Member

    Joined:
    Apr 29, 2015
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Quito, Ecuador
    Hello Tom,

    Thank you for your answer. I'm aware this script is not Linux intended, but since I've tried elbert script on Linux with no issues (on an elbert board of course) I assumed it might also work with MimasV2 script.
    Could you please share the one you tested on Centos, so I can give it a try?

    Thanks,
    Julio

    Edit:
    There's something else. When I try to print the string after line 244, the result is "None".
     
    Last edited: Apr 30, 2015
  9. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Julio, please see below quote from one of my previous replies with the info.

    Thanks,
    Tom

     
  10. Julio Torres

    Julio Torres New Member

    Joined:
    Apr 29, 2015
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Quito, Ecuador
    Hello Tom,

    Thanks. I already tried that before posting my problem. I thought maybe you have changed something else.

    Do you think there might be a problem with the board since I'm not getting an answer when trying to read the flash ID?

    I also tried to "see" a response using Wireshark.

    Thank you,
    Julio
     
  11. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Julio, can you please confirm if the board works with Windows ?

    Thanks,
    Tom
     
  12. Julio Torres

    Julio Torres New Member

    Joined:
    Apr 29, 2015
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Quito, Ecuador
    Hello Tom,

    I'm so sorry for the very late reply.

    Well, I had the chance to try it out on Windows 7 (first installed on a VM and then on a regular installation). It didn't work on the VM, but no problem in the other case. So I guess there's some problem with my Linux system, maybe a missing package. If you have any ideas, please let me know.

    Thanks,

    Julio
     
  13. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Julio,

    So we can rule out the board being a problem and focus on debugging the code. The error message that you see (that the script could not read flash ID) is a little bit misleading in that the actual problem may not be with the flash or the code that is trying to read the flash. The problem could be because somehow Python couldn't communicate with the underlying serial port. The Flash ID error message show up simply because that is the first operation attempted by the script. Can you please check the following ?

    1. Check if pySerial installed. It must be installed with command "python3 setup.py install" NOT "python setup.py install"
    2. Check the permissions on ttyACMx corresponding to the board. Try chmoding to 777 and when everything works, chmod back to a safe permission set that works.
    3. Run script as Super User
    4. Put some print statements in the code check if the script is actually able to open the port specified.

    Thanks,
    Tom
     
  14. Julio Torres

    Julio Torres New Member

    Joined:
    Apr 29, 2015
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Quito, Ecuador
    Hello Tom,

    I did all you recommend.

    The port is open:

    Code:
    ****************************************
    * Numato Lab Mimas V2 Configuration Tool *
    ****************************************
    Serial<id=0x7f298834dc18, open=True>(port='/dev/ttyACM0', baudrate=19200, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)
    Unable to read SPI Flash ID
    But then, when the script sends commands and I don't see a response.
    Do you think there could be some mistake in the construction of the commands?

    Thanks,

    Julio
     
  15. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Julio,

    Thanks for the update. It looks like the port is opened with correct parameters. Now what we need to find out is whether commands are reaching the board and if yes, if the board responds with the correct response. This is going to be a difficult debug effort since we don't have access to the PC and board in questions. I have to rule out the possibility of misconstructed commands because the same script works on Windows and other Linux machines.

    One most important sign to find out if the board is not receiving at all would be to watch the LED D9. If some if the initial commands successfully make it to the board, the LED D9 should turn ON. Can you please confirm what is the status of this LED when the script is executed ?

    Thanks,
    Tom
     
  16. Julio Torres

    Julio Torres New Member

    Joined:
    Apr 29, 2015
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Quito, Ecuador
    Hello Tom,

    Thank you very much for your help.
    Well, i said that about the commands because I haven't tried the script in Windows (actually I haven't seen it working).

    I did what you asked and LED D9 doesn't turn on at all.

    Thanks,
    Julio

    ___________________________________________

    UPDATE: It worked for a second and then it didn't. It seems it might be a problem with my hardware. I'll double check everything and then I'll let you know.


    ____________________________________________
    UPDATE 2: In fact there was a problem with the cable/connector. Now it works.
    However, there's still some problem. I've found out that to make it work I have to run the script as soon as I connect the FPGA to the computer; and even then I have to do it a few time because at first I get errors like this:

    Code:
    ****************************************
    * Numato Lab Mimas V2 Configuration Tool *
    ****************************************
    Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/serial/serialposix.py", line 468, in read
        buf = os.read(self.fd, size-len(read))
    BlockingIOError: [Errno 11] Resource temporarily unavailable
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "MimasV2Config.py", line 531, in <module>
        main()
      File "MimasV2Config.py", line 527, in main
        MimasV2configObj.ConfigureMimasV2(sys.argv[2])
      File "MimasV2Config.py", line 434, in ConfigureMimasV2
        id = self.FlashReadID9Fh()
      File "MimasV2Config.py", line 244, in FlashReadID9Fh
        status, string = self.GetString(3)
      File "MimasV2Config.py", line 224, in GetString
        response = self.ReadData(38)
      File "MimasV2Config.py", line 119, in ReadData
        return self.PortObj.read(count)
      File "/usr/local/lib/python3.4/dist-packages/serial/serialposix.py", line 480, in read
        if e[0] != errno.EAGAIN:
    TypeError: 'BlockingIOError' object is not subscriptable
    
    Or:

    Code:
    ****************************************
    * Numato Lab Mimas V2 Configuration Tool *
    ****************************************
    Micron M25P16 SPI Flash detected
    Loading file mimasv2topmodulelx9.bin...
    Erasing flash sectors...
    Traceback (most recent call last):
      File "MimasV2Config.py", line 531, in <module>
        main()
      File "MimasV2Config.py", line 527, in main
        MimasV2configObj.ConfigureMimasV2(sys.argv[2])
      File "MimasV2Config.py", line 469, in ConfigureMimasV2
        if self.M25P16sectorErase(fileSize):
      File "MimasV2Config.py", line 327, in M25P16sectorErase
        while self.M25P16ReadStatus() & 0x01:
    TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
    
    And if I wait for too long, I get the same error as before.

    I hope you can give me an idea about what's going on with this.

    Thank you,

    Julio
     
    Last edited: Jun 16, 2015
  17. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Julio,

    Thanks for the information, this is very helpful. Another customer had informed us about a similar issue when using the USB-Serial converter feature available on Mimas V2. The issue was, on Linux, if they connect serial terminal software with the port as soon as the board is attached, then the port and communication works. But if they waited for a few seconds and then connect to the port, even though the port is open, they can not communicate. With some firmware modification, we were able to fix it to the most part. Looking at your post above, it looks like the issue here is similar. We will take a look at the possibility of implementing the same fixes to the "Configuration" part of the firmware as well. It may take until next week for any update since the engineer who is handling this firmware is on vacation for this whole week.

    Again thanks for experimenting with the board and providing this crucial information. Unfortunately, the biggest problem here was that it all works great for us (I have posted the images of the script working on both windows and Linux elsewhere in this thread). And it is hard to debug a problem unless it can be reproduced in our lab.

    Thanks,
    Tom
     
  18. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hi Julio,

    Can you please try the attached firmware and see if it helps ? Attached zip file has necessary tool and documentation to help you with firmware update. Also attaching a .bin file to test Mimas V2. Please remove the .txt from the firmware and binary image file names.

    This firmware works much better compared to the old one on our test machine (yes, finally we were able to reproduce the issue on VMware/mint combination). This could still fail occasionally but is expected to work a lot better.

    Thanks,
    Tom

    Attachments deleted, please see next message in this thread.
     
    Last edited: Jul 2, 2015
  19. admin

    admin Administrator Staff Member

    Joined:
    Jan 23, 2015
    Messages:
    169
    Likes Received:
    10
    Trophy Points:
    18
    Hello Julio and others,

    Looks like we have a final definite answer to the issue. The firmware attached to the previous message probably wouldn't work, so I removed it.

    Today I spent half day debugging. I was pretty convinced that the board, firmware and script was good. In fact, I tried the same script on Centos and Windows many many times and it always worked. After a couple hours of script and firmware debugging didn't turn up anything, I decided to echo everything back from the board. I added line in the firmware code so that the board will send back every thing that it received. Flashed the firmware to the board And then tried to send commands again. This time, I monitored everything that came back from the board. Surprisingly, I noticed some AT commands coming back from the board and was sure I never sent any AT commands to the board. At this point I was almost convinced that somebody else is sending commands to the board without my knowledge. Ran command "lsof /dev/ttyACM0" immediately after powering up the board and the result listed ModemManger as the process using the port. Stopped modem manager and power cycled the board... and everything works fine.

    The Modem manager was popping up silently every time the device was attached and was trying to detect the device by sending AT commands and these commands left the firmware in confused state. I would expect apple doing this never expected from a Linux distribution :confused:.

    To stop modem manager on Ubuntu/Mint and other derivative distributions, run the command below.

    Code:
    service modemmanager stop
    Once Modem manager is stopped/removed, reattach the board and try running the script.

    Link below has more info about how to get rid of modem manager.

    http://askubuntu.com/questions/216114/how-can-i-remove-modem-manager-from-boot

    At some point we should fix the firmware so that it won't get confused even if it receives unexpected commands. Hopefully this would fix the issue for now. Please share your results so we can positively confirm if this works for everyone.

    Thanks,
    Tom
    Numato Lab
     
    Last edited: Jul 2, 2015
    Tekkkz likes this.
  20. Tekkkz

    Tekkkz New Member

    Joined:
    Jun 21, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Germany
    Worked for me on Ubuntu 15.04. I also just removed the modem manager with
    Code:
    sudo apt-get purge modemmanager
    because it has no dependencies and is not needed by the system or any devices.
    Thanks for finding the problem!
     

Share This Page