Recent

Author Topic: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library  (Read 88906 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 14369
  • Sensorship about opinions does not belong here.
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #60 on: November 20, 2016, 10:37:40 am »
Yup. The program must run as root or you must configure the program rights such that is allowed access to the low-level hardware (add group with rights, add program name as user to that group)
The latter is always the better solution, but takes more effort.
I always get "grumpy mode on  >:D " when I read that a program *must* run as root, by the way, and reluctant to advice it. (Yes I have grumpy mode on from my own answer, can't help it)
That is almost never the case, must run as root...
It is simply a matter of proper unix system management.

For an average Pi user, however, and to test your software, feel free to run as root ;)
« Last Edit: November 20, 2016, 11:03:28 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

ThomasE

  • Newbie
  • Posts: 2
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #61 on: November 20, 2016, 11:38:21 am »
Brilliant !

I hope I have understood what you propose me to do.
Will try it later to day and come back with the result.

Thaddy

  • Hero Member
  • *****
  • Posts: 14369
  • Sensorship about opinions does not belong here.
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #62 on: November 20, 2016, 01:14:41 pm »
Let us know if your program indeed runs as root, so
Code: Pascal  [Select][+][-]
  1. sudo ./yourprogram

I know it probably does, because I use that unit myself.

I will try to add a wiki subject on the matter on how to avoid root later. If it is not already there somewhere.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

krolikbest

  • Full Member
  • ***
  • Posts: 246
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #63 on: November 27, 2016, 03:33:29 pm »
I'm using Lazarus 1.2.4, Raspbian Jessie, RPi3
Although rpi_hal works excellent, still I'm having one problem-closing program get SIGSEGV. Without rpi_hal everything is ok. Tried to catch it in try except, but no lucky.

Martin
« Last Edit: November 27, 2016, 03:36:42 pm by krolikbest »

sfischer

  • New Member
  • *
  • Posts: 37
New rpi_hal uploaded to github
« Reply #64 on: December 22, 2016, 02:09:22 pm »
Hello rpi_hal users,

just uploaded a new version (V4.3) of rpi_hal to https://github.com/rudiratlos/rpi-hal

I've added some new functions to V4.3 like:

SW Maintenance-/Service-functions:
- Upload Logfiles to FTP-Server
- Download new SW from FTP-Server
- Install new SW on rpi

best wishes,
Stefan

hansotten

  • Jr. Member
  • **
  • Posts: 89
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #65 on: December 22, 2016, 04:06:45 pm »
Thanks!

A welcome Xmas present!

hansotten

  • Jr. Member
  • **
  • Posts: 89
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #66 on: December 22, 2016, 04:20:07 pm »
I'm using Lazarus 1.2.4, Raspbian Jessie, RPi3
Although rpi_hal works excellent, still I'm having one problem-closing program get SIGSEGV. Without rpi_hal everything is ok. Tried to catch it in try except, but no lucky.

Martin
That is quite an old version of Lazarus. Time to upgrade!

rainer

  • Newbie
  • Posts: 2
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #67 on: January 10, 2017, 09:13:40 am »
I am not sure if I am asking here at the right place, so I try. Excuse my long message, I want to give you as many details as possible.

I want to use the cheaper "NanoPI M1" instead of an Raspberry Pi for controlling hardware, robotics, ..., where a Microcontroller (even a powerful PIC18F67J60) is insufficient. This NanoPI M1 uses an "Allwinner H3" chip, a very powerful 4-core 32-Bit model.
As the only working Linux I found "DietPi" (I would love to use openSUSE, but there is no working one). I was able to install DietPi and also to install FreePascal 2.6.4 and started testing:

"Hello World"  is working, so the compiler is basically fine - but this is not want I finally want to do.  ::)

So I started to play with GPIO, but here I have extreme troubles.
Currently a simple LED is connected between Pins 6 (GND) and 12 (GPIO18), of course with a resistor in series, and as first test I simply wanted to control it from FreePascal. But until now I found absolutely no way to get it ON. Not from bash, and also not from FPC.

I downloaded the entire rpi_hal and the testing program from here (https://github.com/rudiratlos/rpi-hal), compiled it, and gave it a try. The test program crashes with an "Access Violation" after showing CPU details.

This is what I get (with already activated debug info):
...
CLK max  :  500.00 MHz
PWMHW min:    1.00 Hz
PWMHW max:   18.75 kHz

GPIOBase    : 20200000
Adr(1F-00)  : FEDC BA98 7654 3210 FEDC BA98 7654 3210
An unhandled exception occurred at $00054088 :
EAccessViolation : Access violation
  $00054088  BCM_GETREG,  line 2968 of rpi_hal.pp
  $00056E3C  SHOW_REG,  line 3416 of rpi_hal.pp
  $00057258  SHOW_REGS,  line 3435 of rpi_hal.pp
  $000573AC  SHOW_REGS,  line 3440 of rpi_hal.pp
  $000573FC  GPIO_SHOW_REGS,  line 3442 of rpi_hal.pp
  $0006C22C  RPI_SHOW_ALL_INFO,  line 6289 of rpi_hal.pp
  $00010734  main,  line 18 of testrpi.pp

2017-01-10 08:55:31 ERR pfio_exit: Exitcode: 217
2017-01-10 08:55:31 ERR RPI_hal_exit: Exitcode: 217


It seems that there is an incompatibility to the "Allwinner H3 CPU inside the NanoPI M1".  :'(

Is there a way to get this working?

I am no specialist in coding at that deep and hardware-dependent level, so I kindly please for help.
« Last Edit: January 10, 2017, 09:15:33 am by rainer »

krolikbest

  • Full Member
  • ***
  • Posts: 246
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #68 on: January 11, 2017, 11:14:22 am »
Hi,

could you explain how would you like to use it in robotics, eg. why do you think RPi3 is insufficient?

Thaddy

  • Hero Member
  • *****
  • Posts: 14369
  • Sensorship about opinions does not belong here.
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #69 on: January 11, 2017, 12:32:22 pm »
GPIOBase    : 20200000 seems wrong to me for that NanoPi.
There's nothing wrong with the CPU otherwise it would not even compile.
Look up the hardware addresses in the documentation for that "NanoPI M1"
If it is sensably designed, you just change the base address.
Also note you may have to test as root... As explained above...

<note to self: I have to order a couple of these cheap ones? (note from wife:but you already have a Pi zero and an expensive subscription) >
« Last Edit: January 11, 2017, 12:39:44 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #70 on: March 04, 2017, 05:32:36 pm »
rpi-hal is currently not working with kernels above #970 (4.9).

Re/install latest supported kernel: #970 SMP Mon Feb 20 19:18:29 GMT 2017 (4.4.50-v7+)

root#> rpi-update 52241088c1da59a359110d39c1875cda56496764   

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #71 on: March 07, 2017, 05:15:49 pm »
Hi,
just uploaded new rpi-hal V4.4 on github: https://github.com/rudiratlos/rpi-hal
This version supports kernel version 4.9

Thaddy

  • Hero Member
  • *****
  • Posts: 14369
  • Sensorship about opinions does not belong here.
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #72 on: March 07, 2017, 05:51:07 pm »
Ah, new toys! like it.
I have some issues, which I will post in a private message. Not that it does not work, but where it can be improved.

Nice job!
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #73 on: March 08, 2017, 03:24:57 pm »
@Thaddy, feel free to contact me. I left my private email-addr in your personal box.

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #74 on: March 08, 2017, 07:42:48 pm »
Hi. I tried this and get this error.

Code: Pascal  [Select][+][-]
  1. Xlib: extension "RANDR" missing on display":1.0"
  2. 2017-03-08 14:12:00 ERR I2C start [0x01]: /dev/i2c-1
  3. 2017-03-08 14:12:00 ERR SPI_Dev_Init[0x00/00]: /dev/spidev0.0
  4. 2017-03-08 14:12:00 ERR SPI_Dev_Init[0x00/00]: /dev/spidev0.1
  5. *** Error in './project1': realloc(): invalid pointer: 0x75ca801c ***
  6.  

 

TinyPortal © 2005-2018