RaspberryPi 4 + Mesa 7c81: need help w/ p2 and p7

More
09 Jun 2021 22:23 #211645 by llamatrails
I'm moving my gantry cnc from a 32bit computer to a RaspberryPi 4 4GB 64bit computer. There is a Gecko G540 connecting the two for the steppers, a BOB for the homing switches, and everything has been working.

I set up the 7c81, loaded the G540X2 configuration with mesaflash, used pncconf for the initial configuration with manual mods afterwards, and have no problem with the steppers, probe, and spindle control which are all connected on P1 to the G540.

The BOB on P2 or P7 with the homing switches is where I'm having issues. Previously, I had no problems with my home switches set to NO and sending ground when closed.

Tried the same with the 7c81 and no luck. I've tried with the 7c81 set to default of P2 or P7 set to pullup, changed them to pulldown, even tried to send 5vdc into the 7c81 instead of ground.

My testing has been by starting linuxcnc (axis), and then running the HAL meter. I can see the pin toggle for the probe-in, which is on the G540, but nothing changes when I try on the P2 or P7 inputs. I have pulled the BOB out and tried to ground the P2 or P7 pins directly on the 7c81 DB25 cable adapters.

So, what am I missing here?
Should I configure the 7c81 to send ground from the home switches, pullup or pulldown?
Should the 7c81.hal for P7 be configured for [HMOT](CARD0).gpio.040.in or [HMOT](CARD0).gpio.040.in_not ?

Appreciate any ideas,
Rick


Here is the console output from linuxcnc:
pi@raspi4:~/linuxcnc/configs/7c81 $ linuxcnc 7c81.ini
LINUXCNC - 2.9.0~pre0
Machine configuration directory is '/home/pi/linuxcnc/configs/7c81'
Machine configuration file is '7c81.ini.expanded'
Starting LinuxCNC...
Found file(REL): ./7c81.hal
Note: Using POSIX realtime

trivkins: coordinates:XXYZ
   Joint 0 ==> Axis X
   Joint 1 ==> Axis X
   Joint 2 ==> Axis Y
   Joint 3 ==> Axis Z
trivkins: Recommend: kinstype=both

hm2: loading Mesa HostMot2 driver version 0.15
hm2/hm2_7c81.0: Low Level init 0.15
hm2/hm2_7c81.0: Smart Serial Firmware Version 43
hm2/hm2_7c81.0: 57 I/O Pins used:
hm2/hm2_7c81.0:     IO Pin 000 (P1-01/DB25-01): IOPort
hm2/hm2_7c81.0:     IO Pin 001 (P1-02/DB25-14): PWMGen #0, pin Out0 (PWM or Up) (Output)
hm2/hm2_7c81.0:     IO Pin 002 (P1-03/DB25-02): StepGen #0, pin Step (Output)
hm2/hm2_7c81.0:     IO Pin 003 (P1-04/DB25-15): IOPort
hm2/hm2_7c81.0:     IO Pin 004 (P1-05/DB25-03): StepGen #0, pin Direction (Output)
hm2/hm2_7c81.0:     IO Pin 005 (P1-06/DB25-16): IOPort
hm2/hm2_7c81.0:     IO Pin 006 (P1-07/DB25-04): StepGen #1, pin Step (Output)
hm2/hm2_7c81.0:     IO Pin 007 (P1-08/DB25-17): IOPort
hm2/hm2_7c81.0:     IO Pin 008 (P1-09/DB25-05): StepGen #1, pin Direction (Output)
hm2/hm2_7c81.0:     IO Pin 009 (P1-11/DB25-06): StepGen #2, pin Step (Output)
hm2/hm2_7c81.0:     IO Pin 010 (P1-13/DB25-07): StepGen #2, pin Direction (Output)
hm2/hm2_7c81.0:     IO Pin 011 (P1-15/DB25-08): StepGen #3, pin Step (Output)
hm2/hm2_7c81.0:     IO Pin 012 (P1-17/DB25-09): StepGen #3, pin Direction (Output)
hm2/hm2_7c81.0:     IO Pin 013 (P1-19/DB25-10): IOPort
hm2/hm2_7c81.0:     IO Pin 014 (P1-21/DB25-11): IOPort
hm2/hm2_7c81.0:     IO Pin 015 (P1-23/DB25-12): IOPort
hm2/hm2_7c81.0:     IO Pin 016 (P1-25/DB25-13): IOPort
hm2/hm2_7c81.0:     IO Pin 017 (J5-TX0): IOPort
hm2/hm2_7c81.0:     IO Pin 018 (J6-TX1): IOPort
hm2/hm2_7c81.0:     IO Pin 019 (P2-01/DB25-01): IOPort
hm2/hm2_7c81.0:     IO Pin 020 (P2-02/DB25-14): IOPort
hm2/hm2_7c81.0:     IO Pin 021 (P2-03/DB25-02): IOPort
hm2/hm2_7c81.0:     IO Pin 022 (P2-04/DB25-15): IOPort
hm2/hm2_7c81.0:     IO Pin 023 (P2-05/DB25-03): IOPort
hm2/hm2_7c81.0:     IO Pin 024 (P2-06/DB25-16): IOPort
hm2/hm2_7c81.0:     IO Pin 025 (P2-07/DB25-04): IOPort
hm2/hm2_7c81.0:     IO Pin 026 (P2-08/DB25-17): IOPort
hm2/hm2_7c81.0:     IO Pin 027 (P2-09/DB25-05): IOPort
hm2/hm2_7c81.0:     IO Pin 028 (P2-11/DB25-06): IOPort
hm2/hm2_7c81.0:     IO Pin 029 (P2-13/DB25-07): IOPort
hm2/hm2_7c81.0:     IO Pin 030 (P2-15/DB25-08): IOPort
hm2/hm2_7c81.0:     IO Pin 031 (P2-17/DB25-09): IOPort
hm2/hm2_7c81.0:     IO Pin 032 (P2-19/DB25-10): IOPort
hm2/hm2_7c81.0:     IO Pin 033 (P2-21/DB25-11): IOPort
hm2/hm2_7c81.0:     IO Pin 034 (P2-23/DB25-12): IOPort
hm2/hm2_7c81.0:     IO Pin 035 (P2-25/DB25-13): IOPort
hm2/hm2_7c81.0:     IO Pin 036 (J5-TXEN0): IOPort
hm2/hm2_7c81.0:     IO Pin 037 (J6-TXEN1): IOPort
hm2/hm2_7c81.0:     IO Pin 038 (P7-01/DB25-01): IOPort
hm2/hm2_7c81.0:     IO Pin 039 (P7-02/DB25-14): IOPort
hm2/hm2_7c81.0:     IO Pin 040 (P7-03/DB25-02): IOPort
hm2/hm2_7c81.0:     IO Pin 041 (P7-04/DB25-15): IOPort
hm2/hm2_7c81.0:     IO Pin 042 (P7-05/DB25-03): IOPort
hm2/hm2_7c81.0:     IO Pin 043 (P7-06/DB25-16): IOPort
hm2/hm2_7c81.0:     IO Pin 044 (P7-07/DB25-04): IOPort
hm2/hm2_7c81.0:     IO Pin 045 (P7-08/DB25-17): IOPort
hm2/hm2_7c81.0:     IO Pin 046 (P7-09/DB25-05): IOPort
hm2/hm2_7c81.0:     IO Pin 047 (P7-11/DB25-06): IOPort
hm2/hm2_7c81.0:     IO Pin 048 (P7-13/DB25-07): IOPort
hm2/hm2_7c81.0:     IO Pin 049 (P7-15/DB25-08): IOPort
hm2/hm2_7c81.0:     IO Pin 050 (P7-17/DB25-09): IOPort
hm2/hm2_7c81.0:     IO Pin 051 (P7-19/DB25-10): IOPort
hm2/hm2_7c81.0:     IO Pin 052 (P7-21/DB25-11): IOPort
hm2/hm2_7c81.0:     IO Pin 053 (P7-23/DB25-12): IOPort
hm2/hm2_7c81.0:     IO Pin 054 (P7-25/DB25-13): IOPort
hm2/hm2_7c81.0:     IO Pin 055 (P5-RX0): IOPort
hm2/hm2_7c81.0:     IO Pin 056 (P6-RX1): IOPort
hm2/hm2_7c81.0: registered
Found file(REL): ./custom.hal
note: MAXV     max: 0.200 units/sec 12.000 units/min
note: LJOG     max: 0.200 units/sec 12.000 units/min
note: LJOG default: 0.083 units/sec 5.000 units/min
Warning: Forward kinematics must handle duplicate coordinate letters:xx

Note:
Individual axis homing is not currently supported for
KINEMATICS_IDENTITY with duplicate axis letter <X>

note: jog_order='XYZ'
note: jog_invert=set([])
Shutting down and cleaning up LinuxCNC...
Running HAL shutdown script
task: 864 cycles, min=0.000025, max=0.023893, avg=0.009997, 0 latency excursions (> 10x expected cycle time of 0.010000s)
hm2: unloading
Note: Using POSIX realtime
pi@raspi4:~/linuxcnc/configs/7c81 $


Here is the mesaflash --readhmid output:
pi@raspi4:~ $ mesaflash --device 7C81 --spi --addr /dev/spidev0.0 --readhmid
unable to set bpw32, fallback to bpw8
Configuration Name: HOSTMOT2

General configuration information:

  BoardName : MESA7C81
  FPGA Size: 9 KGates
  FPGA Pins: 144
  Number of IO Ports: 3
  Width of one I/O port: 19
  Clock Low frequency: 100.0000 MHz
  Clock High frequency: 200.0000 MHz
  IDROM Type: 3
  Instance Stride 0: 4
  Instance Stride 1: 64
  Register Stride 0: 256
  Register Stride 1: 256

Modules in configuration:

  Module: DPLL
  There are 1 of DPLL in configuration
  Version: 0
  Registers: 7
  BaseAddress: 7000
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: WatchDog
  There are 1 of WatchDog in configuration
  Version: 0
  Registers: 3
  BaseAddress: 0C00
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: IOPort
  There are 3 of IOPort in configuration
  Version: 0
  Registers: 5
  BaseAddress: 1000
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: QCount
  There are 2 of QCount in configuration
  Version: 2
  Registers: 5
  BaseAddress: 3000
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: SSerial
  There are 1 of SSerial in configuration
  Version: 0
  Registers: 6
  BaseAddress: 5B00
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 64 bytes

  Module: StepGen
  There are 10 of StepGen in configuration
  Version: 2
  Registers: 10
  BaseAddress: 2000
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: PWM
  There are 2 of PWM in configuration
  Version: 0
  Registers: 5
  BaseAddress: 4100
  ClockFrequency: 200.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: LED
  There are 1 of LED in configuration
  Version: 0
  Registers: 1
  BaseAddress: 0200
  ClockFrequency: 100.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

Configuration pin-out:

IO Connections for P1+Serial
Pin#                  I/O   Pri. func    Sec. func       Chan      Pin func        Pin Dir

P1-01/DB25-01           0   IOPort       None
P1-02/DB25-14           1   IOPort       PWM              0        PWM             (Out)
P1-03/DB25-02           2   IOPort       StepGen          0        Step/Table1     (Out)
P1-04/DB25-15           3   IOPort       None
P1-05/DB25-03           4   IOPort       StepGen          0        Dir/Table2      (Out)
P1-06/DB25-16           5   IOPort       StepGen          4        Step/Table1     (Out)
P1-07/DB25-04           6   IOPort       StepGen          1        Step/Table1     (Out)
P1-08/DB25-17           7   IOPort       None
P1-09/DB25-05           8   IOPort       StepGen          1        Dir/Table2      (Out)
P1-11/DB25-06           9   IOPort       StepGen          2        Step/Table1     (Out)
P1-13/DB25-07          10   IOPort       StepGen          2        Dir/Table2      (Out)
P1-15/DB25-08          11   IOPort       StepGen          3        Step/Table1     (Out)
P1-17/DB25-09          12   IOPort       StepGen          3        Dir/Table2      (Out)
P1-19/DB25-10          13   IOPort       QCount           0        Quad-A          (In)
P1-21/DB25-11          14   IOPort       QCount           0        Quad-B          (In)
P1-23/DB25-12          15   IOPort       QCount           0        Quad-IDX        (In)
P1-25/DB25-13          16   IOPort       None
P5 3,6                 17   IOPort       SSerial          0        TXData0         (Out)
P6 3,6                 18   IOPort       SSerial          0        TXData1         (Out)

IO Connections for P2+Serial
Pin#                  I/O   Pri. func    Sec. func       Chan      Pin func        Pin Dir

P2-01/DB25-01          19   IOPort       None
P2-02/DB25-14          20   IOPort       PWM              1        PWM             (Out)
P2-03/DB25-02          21   IOPort       StepGen          5        Step/Table1     (Out)
P2-04/DB25-15          22   IOPort       None
P2-05/DB25-03          23   IOPort       StepGen          5        Dir/Table2      (Out)
P2-06/DB25-16          24   IOPort       StepGen          9        Step/Table1     (Out)
P2-07/DB25-04          25   IOPort       StepGen          6        Step/Table1     (Out)
P2-08/DB25-17          26   IOPort       None
P2-09/DB25-05          27   IOPort       StepGen          6        Dir/Table2      (Out)
P2-11/DB25-06          28   IOPort       StepGen          7        Step/Table1     (Out)
P2-13/DB25-07          29   IOPort       StepGen          7        Dir/Table2      (Out)
P2-15/DB25-08          30   IOPort       StepGen          8        Step/Table1     (Out)
P2-17/DB25-09          31   IOPort       StepGen          8        Dir/Table2      (Out)
P2-19/DB25-10          32   IOPort       QCount           1        Quad-A          (In)
P2-21/DB25-11          33   IOPort       QCount           1        Quad-B          (In)
P2-23/DB25-12          34   IOPort       QCount           1        Quad-IDX        (In)
P2-25/DB25-13          35   IOPort       None
P5 TXEN                36   IOPort       SSerial          0        TXEn0           (Out)
P6 TXEN                37   IOPort       SSerial          0        TXEn1           (Out)

IO Connections for P7+Serial
Pin#                  I/O   Pri. func    Sec. func       Chan      Pin func        Pin Dir

P7-01/DB25-01          38   IOPort       None
P7-02/DB25-14          39   IOPort       None
P7-03/DB25-02          40   IOPort       None
P7-04/DB25-15          41   IOPort       None
P7-05/DB25-03          42   IOPort       None
P7-06/DB25-16          43   IOPort       None
P7-07/DB25-04          44   IOPort       None
P7-08/DB25-17          45   IOPort       None
P7-09/DB25-05          46   IOPort       None
P7-11/DB25-06          47   IOPort       None
P7-13/DB25-07          48   IOPort       None
P7-15/DB25-08          49   IOPort       None
P7-17/DB25-09          50   IOPort       None
P7-19/DB25-10          51   IOPort       None
P7-21/DB25-11          52   IOPort       None
P7-23/DB25-12          53   IOPort       None
P7-25/DB25-13          54   IOPort       None
P5 1,2                 55   IOPort       SSerial          0        RXData0         (In)
P6 1,2                 56   IOPort       SSerial          0        RXData1         (In)

pi@raspi4:~ $


My entries in the 7c81.hal file:
7c81.hal:

# external output signals

# --- SPINDLE-ENABLE ---
setp [HMOT](CARD0).gpio.007.is_output true
net spindle-enable  =>     [HMOT](CARD0).gpio.007.out

# external input signals

# --- PROBE-IN ---
net probe-in     <=  [HMOT](CARD0).gpio.013.in_not

# --- HOME-X ---
#net home-x     <=  [HMOT](CARD0).gpio.021.in_not
net home-x     <=  [HMOT](CARD0).gpio.040.in_not

# --- HOME-X2 ---
#net home-x2     <=  [HMOT](CARD0).gpio.023.in_not
net home-x2     <=  [HMOT](CARD0).gpio.042.in_not

# --- HOME-Y ---
#net home-y     <=  [HMOT](CARD0).gpio.025.in_not
net home-y     <=  [HMOT](CARD0).gpio.044.in_not

# --- HOME-Z ---
#net home-z     <=  [HMOT](CARD0).gpio.027.in_not
net home-z     <=  [HMOT](CARD0).gpio.046.in_not

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

More
09 Jun 2021 22:56 #211651 by PCW
Do the GPIO pins on P2 and P7 read high with a voltmeter (and read '1' with halmeter or halshow)
when pullups are enabled and they are in input mode?

(input mode meaning they are not an enabled special function and have not been set into output mode)

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

More
10 Jun 2021 00:23 #211660 by llamatrails
Thanks for the quick reply.

From what I remember, halmeter would show either true or false based on if I have in_not in the hal file. I'll check tomorrow with a volt meter and report back.

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

More
10 Jun 2021 22:18 #211744 by llamatrails
Have the issue worked out.

After a lot of checking pin voltages from directly on the 7c81, the IDE-DB25 adapter, the DB25-DB25 cable, and the BOB, it turns out to be a grounding problem. Something in the BOB is blocking the 7c81 ground on the last 9 pins of the DB25 cable from bonding with the BOB ground and everything else.

I pulled the DB25 cable from the BOB, and can toggle the pins in the halmeter by jumping DB25 (say) 25 to each of the active pins for my home switches.

Interestingly, the DB25 cable from P1 connected to the G540 works fine, I can toggle my probe with the same ground that I use for the home switches.

My BOB worked fine when connected to a parallel port on my older x86 computer, it passed the ground from the home switches when tripped.

I'll try a different BOB, at least now I know what is happening.

Thanks again for listening. 8-)

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

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