Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate LR1110 and mbed-os #223

Open
kvkc97 opened this issue Apr 26, 2021 · 26 comments
Open

Integrate LR1110 and mbed-os #223

kvkc97 opened this issue Apr 26, 2021 · 26 comments

Comments

@kvkc97
Copy link

kvkc97 commented Apr 26, 2021

I want t use LR1110 as the LoRa driver for the lorawan example code. I have added the LR1110 driver in mbed-os\connectivity\drivers\lora folder. A pull request for the same was added to the mbed-os and link is given below.
ARMmbed/mbed-os#14560
I am using MBED CLI2 to compile and added STM32WB55RGV6 as a custom target (Custom target addition and compilation was successful). I modified the lora_radio_helper.h file to include the lr1110 driver. The file is attached.
lora_radio_helper.txt

I am getting compilation error as attached.
image

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 26, 2021

First, the config should be all uppercase (lr1110). Can you check if mbed_config.h contians the definitions that are missing?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 26, 2021

If you look at drivers, for instance GEMALTO, you can find mbed_lib.json config where pins are defined

{
    "name": "GEMALTO_CINTERION",
    "config": {
        "tx": {
            "help": "TX pin for serial connection. D1 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
            "value": null
        },
        "rx": {
            "help": "RX pin for serial connection. D0 assumed if Arduino Form Factor, needs to be set/overwritten otherwise.",
            "value": null
        },
        "rts": {
            "help": "RTS pin for serial connection",
            "value": null
        },
        "cts": {
            "help": "CTS pin for serial connection",
            "value": null
        },
        "baudrate" : {
            "help": "Serial connection baud rate",
            "value": 115200
        },
        "provide-default": {
            "help": "Provide as default CellularDevice [true/false]",
            "value": false
        }
    }
}

I assume you need something similar for your radio driver

@kvkc97
Copy link
Author

kvkc97 commented Apr 26, 2021

I do not have mbed_config.h file in my application. Do I need to create one?
Also I can find a mbed_lib.json file in mbed-os\drivers folder but not in the connectivity folder. Is this file to be created?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 26, 2021

If your app is using the config values, they need to come from somewhere. You should add mbed_lib.json to your driver you are adding. The default value I assume would be null. An application, would overwrite this to specific layout you got on your board.

This should fix the issue.

@ciarmcom
Copy link
Member

@kvkc97 This issue has an incomplete or old issue template.For future reference please use an up to date clone of the repository before raising issues. Many thanks.

@ciarmcom
Copy link
Member

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTOSM-3860

@kvkc97
Copy link
Author

kvkc97 commented May 4, 2021

I have added the mbed_lib.json file but still could not understand how and where to define the MBED_CONF_LR1110 variables. I have attached the mbed_lib.json file.

image

@jeromecoutant
Copy link
Contributor

Check cmake_build//develop/GCC_ARM/mbed-os/compile_time_defs.txt

@kvkc97
Copy link
Author

kvkc97 commented May 5, 2021

I checked the above mentioned file and found the variables but could not understand how to move forward with it. Also in the mbed_lib.json file, I have added value NC for spi-mosi, spi-miso and spi-sclk and an error is generated in command prompt. I have attached the error and also the mbed-lib.json file and the compile_time_defs.txt file.
compile_time_defs.txt

mbed-lib.json file
image

Compiler error
image

@jeromecoutant
Copy link
Contributor

jeromecoutant commented May 6, 2021

Definition looks OK in mbed_lib.json.
Then you are supposed to define them in your local mbed_app.json
"lr1110-lora-driver.spi-mosi":"XXX"

@kvkc97
Copy link
Author

kvkc97 commented May 6, 2021

I updated the mbed_app.json file with pin names as per the mentioned format and the following error is obtained.
image

Below is my mbed_app.json file where MYTARGET is custom target for STM32WB55RGV6. I tried to give pin names fr the macros corresponding to SX1272 and it worked properly. I have added all the required pin connections in the below image while checking whether that was the issue. But it was not the issue and error is still the same. I have attached the updated error image also.
image
image

@kvkc97
Copy link
Author

kvkc97 commented May 15, 2021

Can I have an update regarding this issue.
@jeromecoutant @0xc0170 @matthieuantoine

@0xc0170
Copy link
Contributor

0xc0170 commented May 17, 2021

Where are your pinnames defined? THe error indicates the compiler can't resolve PB_15 for instance. It should come from your PinNames.h.

Regarding the custom target,is it linked properly? There was a recent discussion about it , see ARMmbed/mbed-tools#278 (comment) if it helps

@kvkc97
Copy link
Author

kvkc97 commented May 17, 2021

The pinnames are defined in PinNames.h file in the custom target's folder. Have attached the file. The same pins can be defined successfully for SX1272 Radio.

PinNames.txt

I believe the custom target addition is successful as the program is compiled successfully when SX1272 is selected as LoRa radio.

@0xc0170
Copy link
Contributor

0xc0170 commented May 18, 2021

it would be helpful to provide an example that would reproduce an issue (possibly with regular target, adding this new lr1110 driver and get this error).

@kvkc97
Copy link
Author

kvkc97 commented May 18, 2021

I tested with K64F target which is a predefined board in MBED CLI2. Default lora driver is SX1276 whose compilation is successful. However, on adding the custom lora driver LR1110, configuration error is occurred. To add LR1110, I modified the mbed_app.json file in the base directory as below. Error is also attached.
image

image

@kvkc97
Copy link
Author

kvkc97 commented May 26, 2021

Can I have an update on this query

@0xc0170
Copy link
Contributor

0xc0170 commented May 31, 2021

The latest errors might be better to be reported to mbed-tools. It is not obvious what element was not found. What is printed if you use -v - verbose mode ?

@kvkc97
Copy link
Author

kvkc97 commented May 31, 2021

The latest errors are cleared but the pin definition error is still there. I tried to compile using three target board and all three of them are giving the same result, ie, the code is compiled for driver SX1276 but not for LR1110 (custom driver). The same pin definition error as previously attached is displayed.
The three target boards I used include 2 regular targets (K64F and NUCLEO_WB55RG) and 1 custom target (created by me for STM32WB55RGV6)

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 1, 2021

Can you create a simple code snippet or provide a branch we can use to reproduce the issue locally?

@kvkc97
Copy link
Author

kvkc97 commented Jun 1, 2021

I have created a pull request of my code #228
I have used regular target NUCLEO_WB55RG and custom target MYTARGET as preferred.

@kvkc97
Copy link
Author

kvkc97 commented Jun 6, 2021

Hi,

I modified the SX1276 radio files(from COMPONENT_SX1276 folder in mbed-os) with LR1110 radio functions. The code is compiled properly. However, I cannot change the generic pin names(MBED_CONF_SX1276_LORA_DRIVER_NAME) given in the radio files. Is there a way to solve this and also the previous issue of adding custom driver.

@kvkc97
Copy link
Author

kvkc97 commented Jun 16, 2021

Can I have an update on this case

@kvkc97
Copy link
Author

kvkc97 commented Jun 28, 2021

Is there any update on this case.

Thank you

@paul-szczepanek-arm
Copy link
Member

The PR is too big, please just include the changes needed - rebase onto the branch you're making the PR against.

Are you sure you have the configuration options defined in your new driver? Looks like the configuration tools can't find the options you are trying to override in your mbed_app.json.

@kvkc97
Copy link
Author

kvkc97 commented Jun 29, 2021

I have my PR with latest files. The error is persisting. I have mentioned the configuration options I did in my PR. However, I am not sure if there is something missing. The PR is #234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants