Jump to content


Photo

System hangs with SWIRQ

SWIRQ ubuntu14

  • Please log in to reply
58 replies to this topic

#41 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 02 August 2015 - 03:10 AM

If you need precision timing then I would suggest external hardware.



#42 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 02 August 2015 - 03:08 PM

Have you tried running the code but not connecting the trigger. See if it stills hangs?

 

I started my python code and ran without a trigger all night without issue.



#43 harthenry

harthenry

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 02 August 2015 - 06:46 PM

I pulled the plug on the external trigger so that I could test your request.

 

I also added this software into the main loop so I could see if the software was still running;

time ( &rawtime );

timeinfo = localtime ( &rawtime );

printf ( "MainLoop: %s", asctime (timeinfo) );

Delay(1000);

 

And, every 1 second I would get the time and date.  This ran for about 10 minutes.

 

I then plugged in the external 5 hz (5 times per second) trigger back into/onto the pcDuino

 

(Edit) Should have said 5 hz

 

The system now updates the screen 5 times a second with the

 

MainLoop Sun Aug 2 .......  String.

 

So, I went from displaying the MainLoop Sun Aug 2.... Every 1 second (without the external trigger).

 

To, Displaying MainLoop Sun Aug 2.... 5 times a second (plus, my once a second Oscillator message).

 

It appears when an external interrupt occurs, it kills the main loop Delay(1000) timer, and moves onto the next line of code.  No big deal, for my software does not care about this.

 

The Interrupt timer is still timing, however, it will die soon.



#44 harthenry

harthenry

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 02 August 2015 - 07:50 PM

Note, I try different frequencies -- and I get similar results. 5, 10, 30, 50 hz, no different.  System bombs out after various amount of time.



#45 harthenry

harthenry

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 04 August 2015 - 11:19 PM

This weekend I purchased a NetDuino (interpretive) and a Arduino Uno (compiled).  Installed my 10 lines of ISR logic into both, and they both have been running the External Interrupt software for over 20 hours without fail.



#46 harthenry

harthenry

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 06 August 2015 - 01:56 PM

I picked up a Arduino YUN yesterday -- the external interrupts also work just fine.

 

So, not sure where to go from here -- I think the pcDuino External Interrupts do not work.  I have done as much empirical research as I can possible do on this subject -- and, I do not know how to contact the pcDuino factory (if a factory even exists?).  So, I think my next step is to abandon the pcDuino for our product and go with the YUN.

 

Thanks,

HH



#47 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 06 August 2015 - 06:01 PM

Sorry to hear that.

#48 harthenry

harthenry

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 06 August 2015 - 11:39 PM

Hi CW:

 

Me too.  The pcDuino has everything I want/need.  Ethernet, HDMI, 4 GB ram (plus SD), great foot print (Nano), low cost, plus it is a Linux Computer with Arduino IO with Desktop GUI to boot.  WOW! what an awesome system, however, without the ability to have an external interrupt to have consistent readings of the Inputs at 20 mSec samples, I am hosed.

 

There is one possible approach that could save this which I have not explored (nor I am not sure how to do).  This would be to create some type of a bridge between our Arduino Real Time Sketch, and the Mono C# Business Logic sides of our application(s).  I may be able to make the somewhat inaccurate Arduino Sketch Software Timer Interrupt to work if and only if, the Mono C# business logic does not cause the Software Timer Interrupt to fail its ISR call (in the event the Mono C# app is busy hanging on a instruction that takes more than 20 mSec.).  PLUS, I would need some type of Bridge to send small snippets of data back and forth between the Arduino Sketch and Mono C# Business logic sides.  (Note: I cannot use TCP, for we never found a simple effective Client TCP code for the Arduino Sketch side.  I cannot use the Server example that is available on these sites for it is a blocking call -- I think we talked about this several months ago).

 

If you have any thoughts, please let me know.

Thanks,

HH



#49 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 09 August 2015 - 04:42 PM

I have started the torture test. Using your code compiled and running on pcDuino3B. My test is torture because I am using pcDuino to create a 195hz pulse to the pin 3 input. Will update if/when it dies.



#50 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 09 August 2015 - 06:01 PM

It did crash after a few hours. I have changed the code to count to 100 before printing to console now.



#51 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 09 August 2015 - 07:33 PM

I used an LED attached to pin 6 instead of printf and time library to eliminate as much as possible. pcDuino is output 195hz pwm on pin 5 which is connected to pin 3. LED blinks steadily until I start using the system, such as posting this.

#include <core.h>

#define INT_MODE	  FALLING
int iPulse = 0;
int iShutDownPin = 4;
int led_pin=6;
boolean state;


void PartPulse()
{
  printf("PartPulse\r\n");
}

void Oscillator()
{
  iPulse ++;
  if (iPulse == 20)
  {
    iPulse = 0;
    state=!state;
    digitalWrite(led_pin,state);
  }
}

void setup()
{
  pinMode(iShutDownPin, INPUT);
  pinMode(led_pin, OUTPUT);
  digitalWrite(led_pin,HIGH);
  state=true;
  attachInterrupt(1, Oscillator, INT_MODE); // pin 3
}

void loop()
{
  delay(5000);
}

Its now been 30 minutes.



#52 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 09 August 2015 - 09:36 PM

Well over 2 hours now.



#53 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 10 August 2015 - 01:22 AM

Still going....



#54 LIndigo

LIndigo

    Member

  • Members
  • PipPip
  • 17 posts

Posted 10 August 2015 - 06:59 AM

Hi cwilt,

 

it would be interesting too to create a situation in which the problem is easily reproducable. You have reported it crashing as well. I can only switch back to using PCDuino IRQs when I know it will not cause a system hang, regardless of what the PCDuino needs to do besides reacting on the IRQs.



#55 LIndigo

LIndigo

    Member

  • Members
  • PipPip
  • 17 posts

Posted 10 August 2015 - 07:06 AM

Hi harthenry,

 

I started developing with QT on the PCDuino, using the code libraries from arduino sketch to handle the hardware I/O. This worked really well for me as it gives an advanced GUI & library (the QT libraries) at my disposition.  You can certainly use TCP from these to interface with other applications, locally or remotely.

 

basically, the arduino sketch uses c++ libraries you can use as well from another development environment. The only change you need to do is to eliminate the main() function in the arduino libraries so you can write your own main function.



#56 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 10 August 2015 - 10:52 AM

I went to bed at 10pm and shut it down.



#57 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 10 August 2015 - 10:59 AM

Hi cwilt,

 

it would be interesting too to create a situation in which the problem is easily reproducable. You have reported it crashing as well. I can only switch back to using PCDuino IRQs when I know it will not cause a system hang, regardless of what the PCDuino needs to do besides reacting on the IRQs.

 

Since my last experiment worked fine I don't believe it is an IRQ issue. It could be a buffer overrun in the console, a bug in the time library, or a spike on the input. I can eliminate the C code and try with python, but I have never tested it at speed, and I don't think that would do you any good.



#58 harthenry

harthenry

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 15 August 2015 - 05:48 PM

I have been out of touch for a bit for I have been using the basic "Arduino UNO" board (generic knock off board is $6).  The UNO board has been running non-stop for 5 days now, so, for this product, I am going to be using the UNO.  I wish we had time to work through the problems, for I am probably the Number 1 Fan of the pcDuino.  Unfortunately, it is not in the cards for this product.

 

It is overkill for this product, however, I have my 16 bit true 4 port Analog Input Shield (the one I mentioned in one of the above posts), piggy backed onto my UNO, using my external trigger reading values at specific times, and then transfer the data over to the pcDuino via I2C Network.  A crazy way to do things, but it works.

 

I am in the process of slowly removing the pcDuino from the product, and moving the Arduino YUN into its place.

 

I will touch back with you folks on our next product line.

 

thanks,

HH



#59 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 15 August 2015 - 09:39 PM

I understand. You can't say I didn't try. ;)

 

The pcDuino is not the right board for every project. I know I use nodeMCU for a lot of projects. Something you might want to look at.







Also tagged with one or more of these keywords: SWIRQ, ubuntu14

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users