hm2 BSPI documentation, examples?

More
02 Aug 2023 01:17 #276751 by PCW
Does the pin list linuxcnc prints at startup look reasonable?

Are the CS and SCLK pins driven? (pull down with a 1K resistor)

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

More
02 Aug 2023 01:51 #276753 by blazini36
pulldown jumpers are set on the 7i92, not sure how strong they are, I don't have any other passives on the SPI lines between the 7i92 and the 2 MCUs. SCK sits low and the CS lines sit high (~3.2v) when linuxcnc is running.

I can bodge a resistors in if necessary but I'd still expect to see something on the scope.
[color=#000000]linuxcnc /home/justin/linuxcnc/configs/PnP_rev3.0/PnP.ini  [/color]
LINUXCNC - 2.9.0~pre1+git20230208.f1270d6ed7
Machine configuration directory is '/home/justin/linuxcnc/configs/PnP_rev3.0'
Machine configuration file is 'PnP.ini'
Starting LinuxCNC...

(time=1690939551.763521,pid=19140): Registering server on TCP port 5005.
(time=1690939551.763809,pid=19140): running server for TCP port 5005 (connection_socket = 3).
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(REL): ./PnP.hal
hm2: loading Mesa HostMot2 driver version 0.15
hm2_eth: loading Mesa AnyIO HostMot2 ethernet driver version 0.2
hm2_eth: 10.10.10.10: INFO: Hardware address (MAC): 00:60:1b:12:80:41
hm2_eth: discovered 7I92T
hm2/hm2_7i92.0: Low Level init 0.15
hm2/hm2_7i92.0: created Buffered SPI function hm2_7i92.0.bspi.0.
hm2/hm2_7i92.0: Smart Serial Firmware Version 43
hm2/hm2_7i92.0: 34 I/O Pins used:
hm2/hm2_7i92.0:     IO Pin 000 (P2-01): IOPort
hm2/hm2_7i92.0:     IO Pin 001 (P2-14): IOPort
hm2/hm2_7i92.0:     IO Pin 002 (P2-02): IOPort
hm2/hm2_7i92.0:     IO Pin 003 (P2-15): IOPort
hm2/hm2_7i92.0:     IO Pin 004 (P2-03): IOPort
hm2/hm2_7i92.0:     IO Pin 005 (P2-16): IOPort
hm2/hm2_7i92.0:     IO Pin 006 (P2-04): IOPort
hm2/hm2_7i92.0:     IO Pin 007 (P2-17): IOPort
hm2/hm2_7i92.0:     IO Pin 008 (P2-05): InMux Input Mux #0, pin muxdata (Input)
hm2/hm2_7i92.0:     IO Pin 009 (P2-06): InMux Input Mux #0, pin addr0 (Output)
hm2/hm2_7i92.0:     IO Pin 010 (P2-07): InMux Input Mux #0, pin addr1 (Output)
hm2/hm2_7i92.0:     IO Pin 011 (P2-08): InMux Input Mux #0, pin addr2 (Output)
hm2/hm2_7i92.0:     IO Pin 012 (P2-09): Buffered SPI Interface #0, pin CS0 (Output)
hm2/hm2_7i92.0:     IO Pin 013 (P2-10): Buffered SPI Interface #0, pin CS1 (Output)
hm2/hm2_7i92.0:     IO Pin 014 (P2-11): Buffered SPI Interface #0, pin Serial Out (Output)
hm2/hm2_7i92.0:     IO Pin 015 (P2-12): Buffered SPI Interface #0, pin Serial In (Input)
hm2/hm2_7i92.0:     IO Pin 016 (P2-13): Buffered SPI Interface #0, pin Clock (Output)
hm2/hm2_7i92.0:     IO Pin 017 (P1-01): StepGen #0, pin Step (Output)
hm2/hm2_7i92.0:     IO Pin 018 (P1-14): StepGen #0, pin Direction (Output)
hm2/hm2_7i92.0:     IO Pin 019 (P1-02): StepGen #1, pin Step (Output)
hm2/hm2_7i92.0:     IO Pin 020 (P1-15): StepGen #1, pin Direction (Output)
hm2/hm2_7i92.0:     IO Pin 021 (P1-03): StepGen #2, pin Step (Output)
hm2/hm2_7i92.0:     IO Pin 022 (P1-16): StepGen #2, pin Direction (Output)
hm2/hm2_7i92.0:     IO Pin 023 (P1-04): StepGen #3, pin Step (Output)
hm2/hm2_7i92.0:     IO Pin 024 (P1-17): StepGen #3, pin Direction (Output)
hm2/hm2_7i92.0:     IO Pin 025 (P1-05): StepGen #4, pin Step (Output)
hm2/hm2_7i92.0:     IO Pin 026 (P1-06): StepGen #4, pin Direction (Output)
hm2/hm2_7i92.0:     IO Pin 027 (P1-07): StepGen #5, pin Step (Output)
hm2/hm2_7i92.0:     IO Pin 028 (P1-08): StepGen #5, pin Direction (Output)
hm2/hm2_7i92.0:     IO Pin 029 (P1-09): IOPort
hm2/hm2_7i92.0:     IO Pin 030 (P1-10): IOPort
hm2/hm2_7i92.0:     IO Pin 031 (P1-11): IOPort
hm2/hm2_7i92.0:     IO Pin 032 (P1-12): PWMGen #0, pin Out0 (PWM or Up) (Output)
hm2/hm2_7i92.0:     IO Pin 033 (P1-13): PWMGen #1, pin Out0 (PWM or Up) (Output)

All the pins match and generally everything including Smart Serial is working on my PCB.....SPI alludes me here but we have alot to do yet with code, I'm just trying to get something out of SPI at this point

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

More
02 Aug 2023 02:30 - 02 Aug 2023 02:34 #276754 by PCW
You probably have to put some printfs is to see whats (not) happening...
Last edit: 02 Aug 2023 02:34 by PCW.

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

More
02 Aug 2023 02:53 #276755 by blazini36
Has anyone tested a 7i65 on Linuxcnc lately? Is there anyway to verify the bspi driver still works in 2.9? Id really like to find some kind of simple test component to buzz a $5 Amazon weather sensor or something cuz it feels like I'm shooting in the dark here.

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

More
02 Aug 2023 08:55 - 02 Aug 2023 08:55 #276768 by andypugh
Have you addf-ed hm2_7i82.read and .write in the HAL file? Do you have a realtime thread running?
Last edit: 02 Aug 2023 08:55 by andypugh.

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

More
02 Aug 2023 11:45 #276775 by blazini36

Have you addf-ed hm2_7i82.read and .write in the HAL file? Do you have a realtime thread running?
 

Yeah, it's a semi-running machine
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config="num_encoders=0 num_pwmgens=2 num_stepgens=6 num_inmuxs=1 num_bspis=1 sserial_port_0=2xxxxx"
setp    hm2_7i92.0.pwmgen.pwm_frequency 100
setp    hm2_7i92.0.pwmgen.pdm_frequency 6000000
setp    hm2_7i92.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.b
loadrt pnp

addf hm2_7i92.0.read          servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf pid.x.do-pid-calcs       servo-thread
addf pid.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
addf pid.a.do-pid-calcs       servo-thread
addf pid.b.do-pid-calcs       servo-thread
addf hm2_7i92.0.write         servo-thread
setp hm2_7i92.0.dpll.01.timer-us -50
setp hm2_7i92.0.stepgen.timer-number 1

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

More
02 Aug 2023 15:21 #276779 by PCW
Are you running a fairly late copy of LinuxCNC master? There were some changes to the BSPI driver in hostmot2 fairly recently to solve some issue with Ethernet interfaced devices


Also a very low level test might be good to see if write data is being written to the BSPI registers.

Can you start LinuxCNC and then:

sudo tcpdump -x -i eno1 -c 10 > comdump.txt

and post comdump.txt here

(you may have a different Ethernet device than eno1)

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

More
02 Aug 2023 18:37 #276786 by blazini36

Are you running a fairly late copy of LinuxCNC master? There were some changes to the BSPI driver in hostmot2 fairly recently to solve some issue with Ethernet interfaced devices

 

LinuxCNC/AXIS version 2.9.0~pre1+git20230208.f1270d6ed7

I don't remember compiling it on this machine, pretty sure it's the debian apt version.

My ethernet latency is pretty bad on this PC. I remember some conversation with rodw but I didn't look into whether that was resolved or not.

 

File Attachment:

File Name: comdump.txt
File Size:4 KB




 
Attachments:

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

More
02 Aug 2023 18:49 #276787 by PCW
I would definitely update to the latest master

The Ethernet latency issue can usually be fixed by using either an old (4.19)
or new kernel (current non release candidate is 6.4.6-rt8)

The dump shows a data read and write from the SPI FIFO so there maybe some
setup step missing

A 32 bit write to the SPI FIFO:

81c2 0055 efbe adde
= write 1 doubleword to 0x5500 = 0xdeadbeef

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

More
02 Aug 2023 20:27 #276797 by rodw
If you have installed from the Bookworm repos, you can upgrade to the latest version by following the getting linuxcnc docs
linuxcnc.org/docs/2.9/html/getting-start...an_bookworm_x86_only

If you wish to upgrade to master (V 2.10) you just need to substitute
master-uspace for  2.9-uspace
to change to and from, edit this file
/etc/apt/sources.list.d/linuxcnc.list
Sorry but the docs were written specifically  for the pending 2.9 release version

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

Time to create page: 0.244 seconds
Powered by Kunena Forum