Recent

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

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #75 on: March 09, 2017, 01:24:23 pm »
@jdp, pls. try new version V4.5

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #76 on: March 09, 2017, 02:55:13 pm »
Hi. I still get the same error

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #77 on: March 09, 2017, 03:25:50 pm »
if you want to use I2C and SPI, you have to run with user root.

if you run with user pi:
sudo passwd
<enter pwd for root>
su
<login with pwd>
try to run your program

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #78 on: March 09, 2017, 05:36:23 pm »
Hi. I just want GPIO and serial # for now.
I ran it as root and get the same. Do you have to enable it in rapy config even if you dont want those protocols
« Last Edit: March 09, 2017, 05:41:14 pm by jdp »

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #79 on: March 09, 2017, 05:46:49 pm »
pls. download rpi_hal from github again (just uploaded corrected version a few seconds ago) and use the following init sequences in your main program:

if RPI_HW_Start([InitHaltOnError,InitGPIO]) then
begin
  <your code>
end;

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #80 on: March 10, 2017, 07:44:40 am »

I only have one line of code in my test app.

Code: Pascal  [Select][+][-]
  1.  edit1.text = rpi_snr;

I still get the invalid pointer error.

sfischer

  • New Member
  • *
  • Posts: 37
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #81 on: March 11, 2017, 01:34:40 pm »
pls. compile it with -B -gl (e.g. fpc -B -gl), run it and post the outpt.

nyarfa

  • Newbie
  • Posts: 1
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #82 on: March 12, 2017, 07:09:57 pm »
Hi all,

I'd like to use this with some DS18B20. I'm an absolute beginner so thanks if you help me.



jdp

  • Full Member
  • ***
  • Posts: 144
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #83 on: March 14, 2017, 10:47:09 pm »
Where do I set these options ?

pls. compile it with -B -gl (e.g. fpc -B -gl), run it and post the outpt.

sohrab

  • Newbie
  • Posts: 1
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #84 on: March 15, 2017, 08:44:12 pm »
Hi,
Used V4.5 on my Pi3B
Testrpi worked with fpc.  8-)
Result -->
2017-03-16 00:51:58 ERR I2C_start[0x01]: /dev/i2c-1
2017-03-16 00:51:58 ERR SPI_Dev_Init[0x00/00]: /dev/spidev0.0
2017-03-16 00:51:58 ERR SPI_Dev_Init[0x00/01]: /dev/spidev0.1
Show CPU-Info, RPI-HW-Info and Registers:
rpi Snr  : 0000000019a2908f
rpi HW   : BCM2709
rpi proc : 0
rpi rev  : rev4;1024MB;3B;BCM2709;a02082;40~~~


But with lazarus compiles but throws an error on run -
'Project project1 raised exception class 'External: SIGABRT''
In file '../nptl/sysdeps/unix/sysv/linux/raise.c' at line 56


(its run with sudo)
Thanks


« Last Edit: March 15, 2017, 08:46:25 pm by sohrab »

mark

  • New Member
  • *
  • Posts: 11
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #85 on: March 18, 2017, 12:20:32 pm »
thanks for the lib. It seems to have all i need. :-)
except for 1 thing : documentation or samples.
In the readme i see samples mentioned but i can not find them?
As a beginner i like simple and small samples. I want to use SPI but there are a lot of SPI functions/procedures. What to use, and in which order?

for example SPI_Write
I can understand the busnum and devnum.
But the basereg, i have no clue about that. IMO, when using SPI you simply send data. In the PI that is restricted to 8 bit data.
It depends on the Slave device how many bytes i need to send. So i can not figure out this base address which seems to be combined with the data and send as a word.
Why would that be needed?
Or is the base address something that is not sent out with the SPI data?
Do i get a byte or word sent?

And what about the slave select line, must i do this manual or is it automatic?
Lot of questions for a simple protocol.

As i noticed the burst write, i will likely use that. but here too, what to do to use it.
I imagine:
SPI_StartBurst
SPI_BurstWriteBuffer
SPI_EndBurst

mark


Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #86 on: March 18, 2017, 01:37:13 pm »
Hi,
Used V4.5 on my Pi3B
Testrpi worked with fpc.  8-)
Result -->
2017-03-16 00:51:58 ERR I2C_start[0x01]: /dev/i2c-1
2017-03-16 00:51:58 ERR SPI_Dev_Init[0x00/00]: /dev/spidev0.0
2017-03-16 00:51:58 ERR SPI_Dev_Init[0x00/01]: /dev/spidev0.1
Show CPU-Info, RPI-HW-Info and Registers:
rpi Snr  : 0000000019a2908f
rpi HW   : BCM2709
rpi proc : 0
rpi rev  : rev4;1024MB;3B;BCM2709;a02082;40~~~


But with lazarus compiles but throws an error on run -
'Project project1 raised exception class 'External: SIGABRT''
In file '../nptl/sysdeps/unix/sysv/linux/raise.c' at line 56


(its run with sudo)
Thanks
Did you enable I2C in Raspi-config?
Specialize a type, not a var.

mark

  • New Member
  • *
  • Posts: 11
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #87 on: March 18, 2017, 04:15:02 pm »
still not figured out how to use SPI but i tried some things.
i debugged and tried and modified the spitransfer so it could send more than 64 bytes.
But as always there is a new problem : i can not increase the limit of 4096 bytes.
that is more a PI problem. all the things i found on the net do not work. Anyone got this going or ideas?

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #88 on: March 18, 2017, 05:23:01 pm »
Buffer. There are C examples on the RP forum.
Specialize a type, not a var.

mark

  • New Member
  • *
  • Posts: 11
Re: Lazarus / RaspberyPi rpi_hal Hardware Abstraction Library
« Reply #89 on: March 18, 2017, 08:42:46 pm »
after struggling for many hours i give up. maybe when this lib/unit is documented i use it again. for now i tried the PXL lib and it worked within minutes.

 

TinyPortal © 2005-2018