Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RESOLVED - BrickLV Crashes on ISR-trigger
#1
Hi, I operate a PowerPMAC BrickLV PBL8-H23-000-5E00V00. IDE version: 4.3.2.19. Firmware version: 2.3.2.5.

I want to use the CCISR on the high flag from channel 2 and capture the position from that channel.
I use the following commands to set up the CCISR:
Gate3[0].Chan[1].CaptCtrl = 2 ;
Gate3[0].Chan[1].CaptFlagChan = 1 ;
Gate3[0].Chan[1].CaptFlagSel = 3 ;
Gate3[0].Chan[1].TimerMode = 0 ;
Gate3[0].IntCtrl = $00020000 ; //Unmasking position capture on channel 2 as source of CCISR

I too have a phase_interrupt function on motor[0] controling holding current for my stepper motors. So my C-code looks like this:

header.c
------------------------------------------------------------------------------------------------
#ifdef __KERNEL__
#include <linux/module.h>
#else
#define EXPORT_SYMBOL(x) // x
#define KERN_ALERT
#define printk printf
#include <gplib.h>
#endif
#include <RtGpShm.h> // Global Rt/Gp Externals and structures
#include <rtpmacapi.h>

void CaptCompISR(void);
EXPORT_SYMBOL(CaptCompISR);

void user_phase( struct MotorData *Mptr);
EXPORT_SYMBOL(user_phase);
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


usercode.c
------------------------------------------------------------------------------------------------
#include "usrcode.h"

#define _PPScriptMode_
#include "../Include/pp_proj.h"

void user_phase( struct MotorData *Mptr){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if(pshm->Motor[1].DesVel==0){
// Stromeinstellungen Runtersetzen
pshm->Motor[1].MaxDac = Ch1PeakCur * 28378 / Ch1MaxAdc;
pshm->Motor[1].I2tSet = Ch1HoldCur * 28378 / Ch1MaxAdc;
pshm->Motor[1].IdCmd = (pshm->Motor[1].I2tSet)/2;
pshm->Motor[1].I2tTrip = ( pow((pshm->Motor[1].MaxDac),2) - pow((pshm->Motor[1].I2tSet),2) ) * Ch1TimeAtPeak;
}
else{
// Stromeinstellungen hochsetzen
pshm->Motor[1].MaxDac = Ch1PeakCur * 28378 / Ch1MaxAdc;
pshm->Motor[1].I2tSet = Ch1ContCur * 28378 / Ch1MaxAdc;
pshm->Motor[1].IdCmd = (pshm->Motor[1].I2tSet)/2;
pshm->Motor[1].I2tTrip = ( pow((pshm->Motor[1].MaxDac),2) - pow((pshm->Motor[1].I2tSet),2) ) * Ch1TimeAtPeak; }

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

void CaptCompISR(void) {
//-----------------------------------------------//
// Determine IO-Pointer Adresses //
//-----------------------------------------------//
int MyFirstGate3Adr = pshm -> OffsetGate3[0] ;

volatile int *MyFirstGate3IntCtrl = NULL ; // InCtrl direct register pointer declaration
MyFirstGate3IntCtrl = ( unsigned int * ) piom + ( ( MyFirstGate3Adr + 0x224 ) >> 2 ) ; // IntCtrl register adress calculation 4bytes Per Word
//-----------------------------------------------//
int *UshmIntCtrl_isr ;
UshmIntCtrl_isr = (int *) pushm + 18 ;
*UshmIntCtrl_isr = 84 ;

}
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

The phase-routine works without problems. However, when I enable the CCISR by entering {UserAlgo.CaptCompIntr=1} and trigger it by a position capturing event, my BrickLV crashes. I have only used a simple operation of writing a figure to a register which I can access in the watch-table to monitor the succesful execution of the CCISR. When I know that it works, I will use it to store the captured positions to an array in the ushm. I have made use of the CCISR two years ago and cannot remember any issues back then. I guess it might be caused by incomatible soft- and firmware or a known bug. I have not installed the newest soft- and hardware because I have run into issues several times with being able to open my legacy projects. I wanted to ask any reader to see if he sees an error in my CCISR setup,
kind regards,
hannsx
Reply
#2
I found out that my main problem seems to be that I do not get the right adresses when I calculate them manually. Therefore I close this Thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)