Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi and thanks, I changed the for loop for your neat shortcut so thanks. Re inline C, I was going to try this, but when I tried to install the modules I got several errors. Searching for the errors I found that some suggest that cpan dosent run well if at all on the pi because of the limited memory. There are alternatives (cpanm for one IIRC) but I didn't go that path yet. Because of the way that the C functions need the memory mapped addresses and I don't see a way to get these out of the perl module, I guess I would have to implment it all myself inline, which seems like reinventing the wheel a bit, which put me off. That said, I might do this as I have never used inline C with perl before and it seems like a good learning excercise. On the other note, I tried the example code initially, and just silently exits as it does with all values I have yet tried with peri_write. I strace it to produce this output: I'm no expert in understanding the output of strace but I found (with print statements etc) that the mmaps are from the gpio_fsel statements, but theres no further info once execution hits the peri_write line unfortunately. I tried the print suggestion you made, but the results are maybe not of much help, unless I am not doing it right. The C program uses mmap and inputs the base address of the hw, and gets a memory location back, which changes every time the program is executed. In the peri_write function, I am sending the same base address as the C version, but theres no memory mapping going on that I can see (whether this is my problem and I need to somehow get the mmap address back out of the perl module I am not sure). The perl version as far as I can tell keeps the mmap location hidden and internal, and just asks the user to provide the hardware address which it internally translates itself, having stored the offset after making the mmap call - I believe. But am not sure. If you can see that I am interpreting this wrong and I have to get that mmap location myself and use it, that must be my problem. But I can't see any functions in the module which return that location. Thanks, PeteIn reply to Re^2: Device::BCM2835, hardware access on a pi, SIGSEGV
by Peterpion
|
|