Raspberry Pi

More
30 May 2022 06:13 #244185 by differentiable
Raspberry Pi was created by differentiable
Yes, its another Raspberry Pi question.

Actually, its more of a "how is the project organized, where things are built and why?"

I've found a "hal_pi_gpio.c" in /src/hal/drivers.
However, the main application makes no attempt to use GPIO pins, whining about the absence of a parallel port.
Stepconf does not produce any signals on the related pins when testing.
What pin numbering scheme is actually used here?

I would like to avoid resurrecting a dinosaur with a parallel port.

I'm trying to figure out where to add support for a custom serial protocol that would satisfy my needs.

So, what did "hal_pi_gpio.c" do? Where did its binary go?

There are no options to use PI GPIO pins, despite the application having been built natively on a Pi 4 (yes, with PREEMPT RT).

The UART is just as fast as any serial port, and any parallel port adapter will be based on shifting bits into registers just to line things up with the parallel port pins. I might as well pipe that into an Arduino (or ShieldBuddy*) and be able to handle error conditions in a well-defined manner.

I've read about setting groups of IO pins in a single operation on an Arduino, and I've already managed this with a ShieldBuddy.


TL;DR:

How do I make a Raspberry Pi HAL work? Where do I start?
I want to configure a basic 4 axis "mill" with spindle control and have the application push bits through a serial port.
I don't care about the voltage levels right now, I just want to watch lines dance around on a scope.

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

More
30 May 2022 10:43 #244197 by elovalvo
Replied by elovalvo on topic Raspberry Pi
In this link

forum.linuxcnc.org/9-installing-linuxcnc...-io-pins-only#203365

you can find the configuration files (hal and ini) of a minimill using the hal_pi_gpio driver.

Instead at this link you can find the files (hal and xml) of a procedure to drive 2 servos through hal and pyVCP with raspberry pi4 through hap_pi_gpio:

forum.linuxcnc.org/38-general-linuxcnc-q...aspberry-pi-4#222291
The following user(s) said Thank You: differentiable

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

More
30 May 2022 11:43 #244200 by differentiable
Replied by differentiable on topic Raspberry Pi
Thanks!

I did see that thread earlier, but I'm basically coming from "I know how to build it from source, but I have no idea why things are organized this way".

Still running into problems with miscellaneous this-and-that not being found or loaded when trying to start the GUI.

It would be nice to have complete "turn-key" examples for the Pi, even if they just blink LEDs really fast (or are only entertaining through a scope).

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

More
30 May 2022 13:47 - 30 May 2022 13:51 #244211 by elovalvo
Replied by elovalvo on topic Raspberry Pi
A few years ago because of the Covid i have prepared some videos  and a  pdf tutorial (but in Italian language ..) for my students with some examples of use of the hal_pi_gpio module with devices typically used with Arduino such as LEDs, relays, encoders, DC motors, stepper motors, etc.

In the attachment you will find the sources of the examples. 

File Attachment:

File Name: FileHalpigpio.zip
File Size:17 KB


Create a directory (e.g. halsample) and copy all files.
Then from the terminal you go to the halsample directory and execute the command:

halrun -I -f <filename>.hal

where <filename> is the name of the corresponding hal file.

Try and let me know
Attachments:
Last edit: 30 May 2022 13:51 by elovalvo.
The following user(s) said Thank You: differentiable

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

More
31 May 2022 09:43 - 31 May 2022 09:58 #244270 by differentiable
Replied by differentiable on topic Raspberry Pi
Extremely helpful. Thank you.

So far, I've found stepdir_p.hal and stepdir_v.hal to be useful in eyeballing things.

For others browsing, I should add the GPIO pin tables in hal_pi_gpio.c can be used to determine what physical pins correspond to their HAL symbols.

For example: hal_pi_gpio.pin-19-out actually corresponds to pin # 10 on the GPIO header (of a Pi 4). This can be gleaned from the following snippet in the aforementioned .c file:

static unsigned char rpi2_gpios = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 };
static unsigned char rpi2_pins = {3, 5, 7, 29, 31, 26, 24, 21, 19, 23, 32, 33, 8, 10, 36, 11, 12, 35, 38, 40, 15, 16, 18, 22, 37, 13 };


The driver selects different pin mappings depending on the device. These appear to be correct for the Pi 4.
Last edit: 31 May 2022 09:58 by differentiable. Reason: Mistaken about stepper driver issues - my mistake

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

More
31 May 2022 12:22 #244279 by elovalvo
Replied by elovalvo on topic Raspberry Pi
In this pdf file there are the instructions.

 

This browser does not support PDFs. Please download the PDF to view it: Download PDF



if you don't know Italian language, Google Translate can help you ... 
Attachments:
The following user(s) said Thank You: differentiable

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

More
01 Jun 2022 01:22 #244335 by differentiable
Replied by differentiable on topic Raspberry Pi
German for my car, Italian for the mill project, and a good deal of Spanish where I live :P

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

More
02 Jun 2022 11:11 #244440 by andypugh
Replied by andypugh on topic Raspberry Pi
Just as it hasn't been mentioned, stepconf isn't able to build a config for the Pi. It is only for parallel port systems.

However, it could still make sense to pretend that you have a parallel port, just to create the file structure and skeleton of the config.

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

Time to create page: 0.100 seconds
Powered by Kunena Forum