Thanks both of you.  This gives me something to go on at least.  I'm
thinking if I can get something workable I can get it over to the RadioHead
maintainer and maybe they can clean it up if they've been getting any
queries.

On Thu, Apr 9, 2020 at 8:42 AM jonnymo <[email protected]> wrote:

> Note, the code that shbaz has been pushing has not been touched for 6
> years or so and has issues unresolved since 2014 so who knows what kernel
> it was used for.
> Thus, use it at your own peril.
>
> Here is the link to save having to look through the Element14 page for it.
>
> https://github.com/VegetableAvenger/BBBIOlib
>
> Jon
>
> On Thu, Apr 9, 2020 at 5:28 AM Shabaz Yousaf <[email protected]>
> wrote:
>
>> Hi Dave,
>>
>> As a possible option, see here for a combined GPIO, I2C and SPI library:
>>
>> https://www.element14.com/community/community/designcenter/single-board-computers/next-genbeaglebone/blog/2019/08/15/beaglebone-black-bbb-io-gpio-spi-and-i2c-library-for-c-2019-edition
>>
>> This library does not use ioctl, it uses direct register calls
>> internally, so it is fast.
>> In a nutshell it exposes a function called spi_transact. You call it
>> passing in the byte to transmit and the pointer to a byte for the received
>> value, and it performs the SPI interaction.
>> It can be used in a loop to perform multiple byte tx or rx transfers.
>> It's very basic, it is up to the user to store the bytes into an array or
>> handle any conversions.
>>
>> As for support for the library.. I can't support the code much, I have
>> other work too, but if it is a quick question I can try to answer it. It's
>> not mega-complicated, but some C knowledge, maybe even a 'scope or logic
>> analyzer may be needed to use and troubleshoot (not saying there will be
>> issues to require this, but just want to pre-empt it).
>>
>> Another thing is that working with radio devices can (sometimes) be
>> non-trivial. The reason is, some radio events may occur asynchronously.
>> Code may need to be multi-threaded to handle this. It's sometimes not as
>> easy as 'fire-and-forget' so the code needs to implement a state machine to
>> bring up a radio module, transmit, wait for a response, maybe retransmit
>> upon some timer expiry, and so on. I don't know if the LoRa chip or module
>> does that automatically or if the user is expected to implement such things
>> in software.
>>
>>
>>
>> ------------------------------
>> *From:* [email protected] <[email protected]> on
>> behalf of Dave Hojo <[email protected]>
>> *Sent:* 08 April 2020 23:27
>> *To:* BeagleBoard <[email protected]>
>> *Subject:* [beagleboard] RadioHead/SPI driver for LORA Radio
>>
>> I am staring down a rabbit hole and wondering if it's going to be worth
>> it.  I have a Dragino LORA/GPS hat. The LORA bit is SPI. There is a nice
>> library (a fork of RadioHead) where I can just implement an SPI driver, but
>> it's a few notches above my pay grade.  I successfully took some bbb SPI
>> code and the spi_scan that comes with the RadioHead library to query a
>> register and get a version off the device. That's a far cry from cutting
>> into the code and making a new hardware driver for the BBB.
>>
>> What I'm most interested in are the ways I can access the SPI devices. I
>> notice for the raspberry pi driver they're using a hardware library with
>> function calls like this:
>> bcm2835_spi_setDataMode(mode);
>>
>> For my test I used /dev/spidev0.0 with the ioctl and SPI_IOC_MESSAGE.
>> Will I have to write ioctl functions like these or is there a hardware
>> library I can leverage:
>> fd = open(SPI_PATH, O_RDWR);
>> ioctl(fd, SPI_IOC_WR_MODE, &mode);
>> ...
>>
>> I am up for a challenge but I do not want to try and replicate library
>> functions if they exist. I looked at the Adafruit-beaglebone-io-python lib
>> as it has SPI functions (and I might just try to use that) but it seems
>> they, too, are using ioctl.
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beagleboard/d71c0ebc-a5b0-41cb-bd60-a26df4d3dfea%40googlegroups.com
>> <https://groups.google.com/d/msgid/beagleboard/d71c0ebc-a5b0-41cb-bd60-a26df4d3dfea%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beagleboard/DB6P18901MB02140FD0C2A383B162FDA86A84C10%40DB6P18901MB0214.EURP189.PROD.OUTLOOK.COM
>> <https://groups.google.com/d/msgid/beagleboard/DB6P18901MB02140FD0C2A383B162FDA86A84C10%40DB6P18901MB0214.EURP189.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>
>> .
>>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/-jeR8pBmDMY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/CAG99bkoPLGvm3zXq3GXC1hUoKd__6ufe5RbyX3haoLirE2NfHA%40mail.gmail.com
> <https://groups.google.com/d/msgid/beagleboard/CAG99bkoPLGvm3zXq3GXC1hUoKd__6ufe5RbyX3haoLirE2NfHA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAH3%3DPhji_hNjjNTmpdbTkJGaWz1ds%3D-w35mpC5d%2BZUK%2BDoZknA%40mail.gmail.com.

Reply via email to