Go Down

Topic: Running Sqlite update on Linux(openwrt) Side instead of Arduino process (Read 3172 times) previous topic - next topic

Dustboot

Hello Everybody,

I'm working with an Arduino Mega and a Yun shield (v2,4) on a database system on the onboard micro sd card reader.

It work perfectly to run select and update request but when I'm doing an update with several line, it take long time for the MC to do the operation.

Now I'm sending the Sqlite Query on Arduino's process and Linux returned the answer on the same process. In case of update, no data returned but action have to be done by the MC to update informations.

I supposed that all update will be done by the linux side at 400mhz but it seam to be done by the arduino.

When I trigged the update I saw the tiny led blinking very fast for the time the update is running on the arduino, and it take very long time.

for exemple a query took 2000ms inside my computer and took 4min30sec on the Yun board. And I only have a sample of my database...!

 I want to know if it's possible to run those update query inside the linux side?

Can I built a script for linux (openwrt) that will contain the Sqlite query update and I'll call this script by arduino process when it's needed.

I think on this way the update will be done by the linux side. Arduino will only send the trigger to run the linux script.

Maybe I'm wrong, I just supposed that is the arduino making the update because both comm led blink fast when I'm doing the update query and because it's very long. When it's inside linux, arduino not suppose to blink, no?

Thank you for your help

Dustboot

Hello Everybody,

Just to let you know, I made a lot of tests yesterday. I confirmed that the slow processing came from the Arduino so it is not a good idea to call big sqlite update directly from the Arduino inside processing.

So I tried lua, Python, PHP script to run my sqlite3 update Statement from the linux side.

I was able to did it with lua! So I placed a .lua inside the root folder of the Yun Shield with all the code to process the update statement.

Now I only have one problem. I'm not able to make it running from Arduino processing...

I know my lua scrip work fine because I made some test on SSH to shoot directly the instruction to linux with

dofile("/root/Test.lua1") and dofile("/root/Test.lua0")

I'm putting a colum Available to 1 and 0 on a batch of item so I saw the results very quick inside my screen when I did it by SSH!

So the linux side is fine! Only need to do the same via Arduino process!

I tried that

  p.begin("lua");
  p.addParameter("dofile");
  p.addParameter("/root/Test1.lua\")");
  p.run();

and also tried  that

  p.begin("lua");
  p.addParameter("dofile(\"/root/Test1.lua\")");
  p.run();

without any results. The arduino function to that work fine ( I tried with other code to make sure it's executed properly)

This process work fine directly with sqlite3 (except it's very slow), I think it came from the guillemet. I placed few \ before those one on the middle to avoid Arduino to detect them as a variable but i'm not sure if those character was not copy to linux...

So there is another way to write that correctly? Or other way to run a lua script file with less guillemet in it?

Thank you






Dustboot

Hello Everybody,

After a lot of test, similar problem is coming. At the time I'm using the Arduino to send the commande to linux, all nexts task is very long.

I made a test by using putty to send directly the commande via ssh to run the same lua script that I called from the Arduino.

At this time, no blinking led on Arduino and update went very fast. I only go to another page and came back to see the results and there are there.

When I calling the same file by arduino, the led blinking very fast on Arduino and it take around 45sec to update. Lot of difference!

So I thing the process take all the juice from linux! In the past I saw that process runinng at 90% of the cpu so I'm starting to think that it came from there. The linux side always check if there is something came from the process.

The question now : There is a way to kill the process task inside linux and reactivate it after the update will be finished? For sure inside the same lua script.

1 - Like start by killing process
2 - do all the update of database
3 - restart process to listen again next command

Thank you


Go Up