mesaflash halts writing firmware

More
21 Jan 2022 13:56 #232639 by fehertamas
Hello everyone,
I've encountered an interesting problem, and would like to ask how could I resolve it.
I'm trying to get started on a new 6I25 board (default configuration in 5I25 compatibility mode)
(installed using the LinuxCNC 2.8.2 Debian 10 Buster PREEPT-RT ISO)
After going through the pcnconfig and setting up some permissions, linuxcnc fails with the following output:
LINUXCNC - 2.8.2-11-g6a3d0a434
Machine configuration directory is '/home/test/linuxcnc/configs/gantry_test_setup'
Machine configuration file is 'gantry_test_setup.ini'
Starting LinuxCNC...
Found file(REL): ./gantry_test_setup.hal
Note: Using POSIX non-realtime
hm2: loading Mesa HostMot2 driver version 0.15
hm2_pci: loading Mesa AnyIO HostMot2 driver version 0.7
hm2_pci: discovered 5i25 at 0000:07:00.0
hm2/hm2_5i25.0: Low Level init 0.15
hm2/hm2_5i25.0: invalid cookie, got 0xFFFFFFFF, expected 0x55AACAFE
hm2/hm2_5i25.0: FPGA failed to initialize, or unexpected firmware?
hm2_5i25.0: board fails HM2 registration
RTAPI_PCI: Unmapped 65536 bytes at 0x7f13a4491000
Driver probe function failed!
hm2_pci: error registering PCI driver
hm2_pci: rtapi_app_main: Operation not permitted (-1)
./gantry_test_setup.hal:9: waitpid failed /usr/bin/rtapi_app hm2_pci
./gantry_test_setup.hal:9: /usr/bin/rtapi_app exited without becoming ready
./gantry_test_setup.hal:9: insmod for hm2_pci failed, returned -1
Shutting down and cleaning up LinuxCNC...
Running HAL shutdown script
hm2: unloading
Note: Using POSIX non-realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/test/linuxcnc_debug.txt
and
    /home/test/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

I thought I need to update the firmware on the board so i tried doing that with mesaflash:
sudo mesaflash --device 5i25 --write 5i25_7i78x2.bit
the output of that command is the following:
Checking file... OK
  File type: BIT file
Error: BootSector is invalid
Then tried the same with the fix-boot-block flag:
sudo mesaflash --device 5i25 --fix-boot-block --write 5i25_7i78x2.bit
And this command just halts and spins the cpu on 100%.(left it alone for an hour a couple times)
This is the output from it:
Checking file... OK
  File type: BIT file
Erasing sector 0 for boot block
Anyone has any idea what could cause getting stuck? Or am I going the wrong direction with mesaflash?
Any Ideas welcome!
Cheers,
Tamas

Please Log in or Create an account to join the conversation.

More
21 Jan 2022 15:22 #232646 by tommylight
Did you move any jumpers on the card?
If yes, shut down, remove card, set jumpers to default, plug in the card, power on.
If not, try a different PCI-E slot.
PCI-E slots can be shared with NVME, other PCI-E slots, SATA, WiFi, so ..... complicated.
You can insert the Mesa 6i25 in any PCI-E slot, be it X1, X4, or X16, it does not matter works in all of them.

Please Log in or Create an account to join the conversation.

More
21 Jan 2022 16:11 #232650 by PCW
There seem to be multiple problems here:

"Note: Using POSIX non-realtime"

Likely indicates a permission issue of some kind (why did you change any permissions?)

Please Log in or Create an account to join the conversation.

More
21 Jan 2022 16:17 #232651 by fehertamas
Hi, thank you for the quick reply to my case!
I've tried both default (33MHz PCI clock) and 6I25 compatible (66MHz PCI clock) configuration in multiple PCIe slots, that didn't help.
Although now I managed to get past the halting!
I've cloned the mesaflash repository (github.com/LinuxCNC/mesaflash) and built it locally to have the latest version by following the steps in the readme.
with the built version the flashing works!doesn't halt, finishes OK with verification.
working version: 3.4.2
version shipped on the iso: 3.4.0~pre1

Now the issue I'm facing right now is that the init LED blinks, which means it's using the fallback firmware after flashing it with:
sudo ./mesaflash --device 5i25 --write 5i25_7i78x2.bit --verbose

Please Log in or Create an account to join the conversation.

More
21 Jan 2022 16:38 #232654 by PCW
1. Note that you should never use anything but a 5I25 (33 MHz) setup with 5I25 bitfiles
2. Does "sudo ./mesaflash --device 5i25 --readhmid" report reasonable values?

Please Log in or Create an account to join the conversation.

More
24 Jan 2022 17:48 #232988 by fehertamas

1. Note that you should never use anything but a 5I25 (33 MHz) setup with 5I25 bitfiles
2. Does "sudo ./mesaflash --device 5i25 --readhmid" report reasonable values?
 

Solved the blinking issue, the problem was that I didn't do proper power cycling of the card after flashing it. After disconnecting the power and putting it back it has loaded the right firmware and the "sudo ./mesaflash --device 5i25 --readhmid" has the right output now!

Please Log in or Create an account to join the conversation.

More
24 Jan 2022 18:00 #232990 by fehertamas

There seem to be multiple problems here:

"Note: Using POSIX non-realtime"

Likely indicates a permission issue of some kind (why did you change any permissions?)

Wow, good catch! Yes, seems like I still had permission problems. 
Looks like the rtapi_app didn't have good permissions out of the box. 
It's been fixed with 
sudo chmod 4755 /usr/bin/rtapi_app
So now it loads and uses the realtime POSIX
But I suspect that's not the right way of solving it.
Perhaps I miss a step after the os installation?

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.112 seconds
Powered by Kunena Forum