Something funky is going on with my end-stops. I am trying to use X2, Y2 and Z2. X2 and Z2 work fine, Y2 is triggering an event that is picked up in python (I get a “End Stop Y2 hit!”, i.e. event.code = 115) but if I inspect the PRU according to “state = PruInterface.get_shared_long(0)” I get “state = 0b0”. This should be 0b10000. Inspecting all the other end stop pins with PruInterface gives me the expected values ranging from 0b1 to 0b100000.
The end result is that while python is telling me that I have hit an end stop, the corresponding axis is not being masked off by the step generator and so unhappy things happen. Any ideas what is going on?
I am using the latest version of the develop branch. That tool was the first thing I used to inspect the raw end stop values. Then I hacked together some of the pru code from Endstop.py as another check and got the same thing. I’ve changed to using X1 Y1 Z1, which work fine, but it is something that is a bit of a worry.
I did a quick test now, and checked the output from Y2; it does report it in the end stop tool and also stops the right axis if configured with M574. Did you not see the change using the end stop tool?
Thanks for checking on your hardware. I used the end stop tool and triggered all the end stops in sequence and get the following X1:0b1, Y1:0b10, Z1:0b100, X2:0b1000, Y2:0b0, Z2:0b100000. So it appears there is no response registered by the PRU. Yet there is still an event registered in /dev/input/event0 leading to a notification in the log that Y2 has been hit. I am seriously confused about what is happening!
The thing is that there is no connection between the evdev and that of the PRU. One is simply used to notify the user/alarm. The other will block PRU 0 from doing anything, but it will not give an event back to “user space”. Could you double check that the GPIO bank and pin is right in the config.h? If I’m not mistaken, Y2 has been problematic before… I have bank 3, pin 17 which is working.
and observed that end stop Y2 was mapped to gpio-51. This corresponds to bank 1, pin 19 (banks increment by 32 so 51 - 32 = 19). I then added “pin_Y2 = GPIO1_19” to my .cfg file (changed from GPIO3_17), and re-started Redeem to re-compile the PRU firmware. I then ran the endstop_test.py script that is in the tools folder and checked all my end stops again. End stop Y2 (and all the others) are now registering correctly.
The following sites helped me once Elias pointed me in the direction of sysfs.