Advanced Search

Search Results (Searched for: )

  • Zayoo
  • Zayoo
09 Dec 2024 22:34

LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)

Category: Computers and Hardware

Regarding rpi5 I swap to riocore so there is some changes.
For old rio follow instructions on rio page 11

Here is changes for riocore:

I have a raspberry pi5 and this is the code of how I started the SPI communication of the RPI5 - TangNano9K. (Not yet machine tested)

OS:  In /boot/broadcom/config.txt check is SPI is enabled (reboot if not)

# uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

In /dev/
Check do you have listed spidev0.0, should be!

Generate output files as for raspberry pi4. When you have generated them, find the file 'riocomp.c' and open it. In general, you need to find and replace the code responsible for rpi4 SPI communication. You need to swap approximately 4200 lines of code with around 60 lines, swap FROM:
/*
    interface: SPI
*/

INSERT CODE:
#include <linux/spi/spidev.h>
#include <sys/ioctl.h>  
int spifd;
static uint8_t mode = SPI_MODE_0;
static uint8_t bits = 8;
static uint32_t speed = 1500000;
int spi_init(void) {
   
    rtapi_print("Info: Initialize SPI5 connection\n");
    spifd = open("/dev/spidev0.0", O_RDWR);
    if (spifd < 0) {
        rtapi_print_msg(RTAPI_MSG_ERR,"Failed to open SPI device\n");
        return -1;
    }
    // Set SPI mode
    if (ioctl(spifd, SPI_IOC_WR_MODE, &mode) == -1) {
        rtapi_print_msg(RTAPI_MSG_ERR,"Failed to set SPI mode\n");
        close(spifd);
        return -1;
    }
    // Set bits per word
    if (ioctl(spifd, SPI_IOC_WR_BITS_PER_WORD, &bits) == -1) {
        rtapi_print_msg(RTAPI_MSG_ERR,"Failed to set bits per word\n");
        close(spifd);
        return -1;
    }
    // Set max speed
    if (ioctl(spifd, SPI_IOC_WR_MAX_SPEED_HZ, &speed) == -1) {
        rtapi_print_msg(RTAPI_MSG_ERR,"Failed to set max speed\n");
        close(spifd);
        return -1;
    }
}
int spi_trx(uint8_t *txBuffer, uint8_t *rxBuffer, uint16_t size) {
        struct spi_ioc_transfer tr = {
        .tx_buf = (uint64_t)txBuffer,
        .rx_buf = (uint64_t)rxBuffer,
        .len = size,
        .speed_hz = speed,
        .delay_usecs = 0,
        .bits_per_word = bits,
    };
    // Perform SPI transfer
    if (ioctl(spifd, SPI_IOC_MESSAGE(1), &tr) == -1) {
rtapi_print_msg(RTAPI_MSG_ERR,"Failed to perform SPI transfer\n");
    }
    return 1;
}
 
TO:
int interface_init(void)  {
     spi_init();
}

/*
   hal functions
*/


Find and add:
//ADD to rtapi_app_exit ->> close(spifd);
void rtapi_app_exit(void) {
    close(spifd);
    hal_exit(comp_id);
}
 

And that's all. This procedure with 'riocomp.c' must be repeated every time the output files are regenerated.
 
  • piter_iceman
  • piter_iceman
09 Dec 2024 21:38 - 10 Dec 2024 07:57
Replied by piter_iceman on topic Error reading pdos / motors are not moving - solved!

Error reading pdos / motors are not moving - solved!

Category: EtherCAT

  1.  
  2. It's working!!! The vid="0x00445653" and pid="0009252" must exactly match the driver's configuration, and the registers should start from RxPDOs - 0x1600 ; TxPDOs 0x1A00 - verified in TwinCAT 2 and ethercat sdos
  • tommylight
  • tommylight's Avatar
09 Dec 2024 21:21
Replied by tommylight on topic Kuka robot project - hardware choice

Kuka robot project - hardware choice

Category: Driver Boards

Vevor no, but maybe, usually not isolated.
The 1000VA looks good, has outputs that can be paralleled giving 8.7A and can handle quite some beating, so get 1 of those, it will be more than enough for testing and running individual motors. After you do that, you can try using 2 or more motors with it and see how it behaves, you might just get away with 2 or 3 of those if no fast acceleration is needed.
Kuka does not makes drives, Siemens does/did, although that looks like something Beckhoff would make, so try finding more info on them. Also notice Kuka used fieldbus and profibus for comms...
Displaying 22051 - 22053 out of 22053 results.
Time to create page: 0.404 seconds
Powered by Kunena Forum