Git Product home page Git Product logo

Comments (18)

Citrullin avatar Citrullin commented on May 18, 2024 2

I am interested in this as well. Especially with the NimBLE stack.

from renode.

grifcj avatar grifcj commented on May 18, 2024 1

Was able to get a softdevice-based peripheral advertising. Used the Nordic SDK 17.1.0 and SD 7.2.0. Based on the ble_app_hrs demo with some modifications to disable the security related features as peripheral models don't currently support. Quickly tried connection with the central from same example set, but that unfortunately didn't work.

Requires a few simple fixes to peripheral models, which I did on top of existing bluetooth PR here in branch bluetooth-softdevice. Wasn't sure if changes should stack on top of existing PR, as it might redundantly contain the existing PR's commits.

I attach the modified ble_app_hrs main.c and *.resc for reference. Can go in a bit more detail on building with that SDK or just supply the binaries if desired.
example.zip

One other important caveat is that simulation seems to need to run at 1 us quantum. Anything more, and the peripheral will advertise once, but then effectively halts with WFE as scheduling with timer0 gets messed up. Compare values to drive timer events seem to be somewhat aware of time passing.

Overall, trying to workout issues with no source code (i.e. just the soft device binary) is unsurprisingly a bit tricky. Given Nordic seems to be moving on to open source Zephyr based solutions for the future anyways, probably turn my attention to enabling more features (e.g. security) with that SDK.

Screenshot from 2021-11-05 01-06-58

from renode.

grifcj avatar grifcj commented on May 18, 2024 1

Attempts with RIOT went a little better. Setting up was just cloning the repo, putting arm toolchain on path and calling make BOARD=nrf52840dk -C examples/nimble_heart_rate_sensor.

Screenshot from 2021-11-09 00-55-08

There was at least one issue in the RTC model. IRQ was being gated on event enable, and that's not how the hardware works as can be seen in the nrf52840 product spec, so that needs to be fixed and pushed to PR.

image

So advertising seems to work, but connection with central not quite working yet. Didn't see a central example in riot repo, so was just using the zephyr central to try to connect. Central sees advertising from riot peripheral, and sends a connect request, but things don't get established. Will have to investigate more.

If you'd like to try hacking some yourself, the build docs are here. Which is basically just install pre-reqs and run build.sh from cloned renode repo. The current bluetooth capabilities require build from source, since it's ongoing PR. You'll need the bluetooth-work branch from my forks of renode and renode-infrastructure.

Attaching script file I used. You would need to update paths to bins to where they are on your system.
bluetooth.zip

If that's way too brief to be of much use, you can try dropping me a line at [email protected].

from renode.

mgielda avatar mgielda commented on May 18, 2024

Hi Ahmed, this is a matter of supporting a specific radio model for a given Bluetooth-enabled platform. Which Bluetooth platform (board/SoC) were you interested in specifically, and what sample would you like to run - could you describe the use case in more detail, this would help us with setting our priorities.

from renode.

AhmedHussein534 avatar AhmedHussein534 commented on May 18, 2024

from renode.

mgielda avatar mgielda commented on May 18, 2024

Hi Ahmed, we do not at this point support any Bluetooth peripherals, but it's definitely something we'd like to do if there is enough need for it. I'll mark this as a feature request.

from renode.

mchodzikiewicz avatar mchodzikiewicz commented on May 18, 2024

Hi, I am interested in testing nrf52 as well but unfortunately not via Zephyr's bluetooth stack, but NRF SDK.

Since the bluetooth stack is a binary blob in nRF SDK, perhaps a way of work is to mock supervisor calls instead of actual peripheral beneath it?
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0179b/ar01s02s07.html

Is it supported somehow? I guess it would enable Renode in the uglier projects, where you are dependent on vendor's impl

from renode.

jain0nikhil avatar jain0nikhil commented on May 18, 2024

Is Bluetooth peripheral support enable for nRF52840DK if yes, can you share some sample code?

from renode.

PiotrZierhoffer avatar PiotrZierhoffer commented on May 18, 2024

@jain0nikhil while we do have the nRF52840 chip supported, it does not yet have radio connectivity.

from renode.

jain0nikhil avatar jain0nikhil commented on May 18, 2024

@PiotrZierhoffer is there any plan for supporting Bluetooth Peripheral.
One more question: I am trying to run one custom FW on emulator in which FLASH changed to 0x27000 from 0x00 but nothing happen in emulator after loading binary. Do I need to specify some extra value for that ?

from renode.

jain0nikhil avatar jain0nikhil commented on May 18, 2024

is there any board which support radio connectivity in renode which I can refer for adding support for nRF?

from renode.

PiotrZierhoffer avatar PiotrZierhoffer commented on May 18, 2024

We have some 802.15.4 radios you can look at, for example CC2538 or CC2520. The communication layer will be similar, but we have no bt radios at the moment.

nRF52840 BT is not in the nearest scope, so I can't give you any specifics.

Regarding your other question: you need to adjust the flash location in the repl file and in your linker scripts. That's not enough information to say anything specific though.

from renode.

grifcj avatar grifcj commented on May 18, 2024

As of very recently, I was able to get a simulation going with zephyr on nrf52840 using the heart-rate samples and have a connection between a central and peripheral. See this PR in infrastructure repo. Wasn't sure if I could hijack this issue, or if I should open another one for that PR, given this seems to be about zephyr bluetooth samples with renode.

Haven't tried any soft-devices yet with renode, but ultimately would be interested in that too as a I have a few projects using them. However, to get simulations going, a completely open source implementation has been indispensable for education and troubleshooting. Was hoping that experience with zephyr might transfer well to simulations with soft-devices.

from renode.

Citrullin avatar Citrullin commented on May 18, 2024

Overall, trying to workout issues with no source code (i.e. just the soft device binary) is unsurprisingly a bit tricky. Given Nordic seems to be moving on to open source Zephyr based solutions for the future anyways, probably turn my attention to enabling more features (e.g. security) with that SDK.

If you have time you can give NimBLE a try. It is used as the BLE stack in RIOT and MyNewt. Espressif also uses a fork for their ESP32 with FreeRTOS. So, I guess you can also use it in FreeRTOS.

from renode.

grifcj avatar grifcj commented on May 18, 2024

Would like to cross-check models against another stack. So far, basics seem to work with zephyr and at least advertising with softdevice. If NimBLE hardware implementation is similar enough, it might already function as well.

Spent an hour or so with MyNewt, unfortunately wasn't able to get it to build an acceptable elf of the blehr sample in nimble repo targeting the nrf52840. Have any direction there? Didn't try RIOT. Perhaps have better luck with their getting started docs. Doesn't matter if RIOT or MyNewt, whichever one is easiest, but need some sample apps, preferably a central and peripheral that implements hr, like the sample apps for Zephyr.

With that, it could be assessed whether or not NimBLE functions on renode with the PR branch

Unfortunately, my time is limited for platform ramp up / education in near term. Would probably prefer spending effort in near term towards expanding out zephyr-based solutions since I already have a foothold there.

from renode.

Citrullin avatar Citrullin commented on May 18, 2024

Spent an hour or so with MyNewt, unfortunately wasn't able to get it to build an acceptable elf of the blehr sample in nimble repo targeting the nrf52840. Have any direction there? Didn't try RIOT. Perhaps have better luck with their getting started docs. Doesn't matter if RIOT or MyNewt, whichever one is easiest, but need some sample apps, preferably a central and peripheral that implements hr, like the sample apps for Zephyr.

I also don't have any experience with MyNewt. I can help you with RIOT though, if you want to. If you give me your contact, I can probably make some time in order to help you with this.
I only used the IPv6 over BLE stack though. But I guess if that works fine, the rest shouldn't be an issue.
I would recommend a Linux though. I tried to make it work on Windows, but it makes it very complicated to get it running due to the not proper USB support in WSL2. Mac also makes some issues in my experience. Linux (at least Debian based) is very straight forward, since the build system of RIOT is just a couple of Makefiles.
The RIOT documentation though... Let's say developer don't really like to write a lot of documentation, I guess :D
/e Ahh, I see in your screenshots you are already using a Linux. Judging from the background color, Ubuntu, I guess. So, that shouldn't be an issue to get it running.
I wrote this guide for the w3c wot wg once. Maybe that is a straight forward starting point. Not the most recent dev branch, but it should give you a good starting point, I think.
https://github.com/w3c/wot-testing/tree/main/events/2020.09.Online/prototypes/RIOT-OS
There are a lot of example which should work in a similar way
https://github.com/RIOT-OS/RIOT/tree/master/examples

If you point me into a direction how I can run the elf with the BLE implementation, I am happy to give it a try.

from renode.

Citrullin avatar Citrullin commented on May 18, 2024

If you'd like to try hacking some yourself, the build docs are here. Which is basically just install pre-reqs and run build.sh from cloned renode repo. The current bluetooth capabilities require build from source, since it's ongoing PR. You'll need the bluetooth-work branch from my forks of renode and renode-infrastructure.

Great that the build process works. I am not so much into the low level Bluetooth stack. I will give it eventually a try. Thanks for the pointer to the resources.

from renode.

PiotrZierhoffer avatar PiotrZierhoffer commented on May 18, 2024

With the BLE support for nRF52840 we released (with enormous help from @grifcj) I believe I can close this issue. If any other issues related to BLE are encountered, let's track them separately

https://antmicro.com/blog/2022/04/developing-and-testing-ble-on-nrf52840-with-renode-and-zephyr/

from renode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.