This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Atmel Atemga328p Device configuration

Update: I've worked on the BLE arduino sdk from Nordic, and followed all the directions, but I'm having some compiler errors. I've crossposted to a different forum for more AVR centric issues, and because I could attach my source code, but if anyone may have a clue as to what it is, its here www.avrfreaks.net/index.php

I could have also posted here, but again, I don't think I can attach my files. I hope this works out, this is a really strange set of errors.

To clarify: I need a bit of guidance/hand holding to start porting the nRF8001 to interface with the Atmel Atmega328p using only C, not C++ or Arduino.

This seems like a simple enough question, and I tried using google to see if there are any predefined libraries, or reading the documentation, or even searching here/stackexchange.

I'm trying to implement a project with an Atmel Atmega328p using C code (no C++), no bootloader, no arduino, it isn't allowed. It is for a class project for embedded systems, but we haven't had any experience in setting up too many driver setups and I'm slightly confused at the process.

So far I've made a general bluetooth App for android and a Python Bluetooth application for desktop. I've done all of the hardware portions of the project, and made sure they work with the code. I'm simply using the Bluetooth for communication to check data logging, current status, sensor readouts, and setting triggering levels from my phone or desktop that interfaces with the Atmega

I bought the www.adafruit.com/.../1697 (nRF8001 breakout board) from adafruit, because I was doing a bunch of purchases from there. At the time I didn't see all the Dev Kits from Nordic Semi, but I thought I could still get everything working.

I've downloaded the SDK, and nRF studio. I've seen the github repos for both Nordic and Adafruit.

The only things that seem clear to me is that I can use nRF studio to edit the parameters of the nRF8001 for the configuration files. Then take those files and use the header files they produce. There are quite a few examples so I wasn't sure which to use. I also saw that you can port over the arduino files by editing the Arduino portions out at changing to a .c.

I'm really looking for some advice on how to begin, I'm a real beginner at all this, I was overwhelmed as it is making Device drivers for the TI CC3000 for wifi, and I thought this time maybe i should ask the dev community.

I hope I have googled and searched correctly, dont' mean to waste anyones time. All combinations of Atmel, Avr, and Atmega with nRF8001 and Nordic Semi have been searched.

Thank you for any help!

  • When I was working with nrf8001, the first thing to do was to get proper SPI communication with module. Once You get Your uC speaking with nrf, read about nrf8001 modes, and try to implement basic commands/events. Actually, almost everything that is nessecary is in nrf8001 product specification document.

  • Thank you, I will try this. I read somewhere that the ACI parameters are an implementation using SPI. So for that, do you think I would need the ACI parameters using nRF studio? Or is that a later stage thing.

    You know it might seem pretty ignorant. I was reading on BLE last night from the Bluetooth SIG. They have some app accelerator and general information. And adafruit had a little presentation talking about the parameters of BLE like GATT. I haven't had a chance to read about nordics product document judt yer, except to try to get the actual SDK (not the Bluetooth arduino one). Thanks for giving me a starting point.

  • I worked on 8001 few months ago and I forgot about something: as far as I remember, Nordic provided example sources for c51 processor to communicate with nrf8001. What I would recommend is to port SPI and try using those examples on AVR - as a total newb, I was able to make it work on similar uC going that way. Once You have core application working, You can modify BT services in nrf studio (and send those settings in header via SPI to nrf8001) and just manage incoming /outgoing data in Your app. Libraries used in those examples makes everything very easy, just make them work You.

  • Do you know where to get these examples? https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF8001 If its from the SDK I realized that you need to have an actual dev board to get a product key, which I regret to not have known earlier.

    I'm using https://github.com/NordicSemiconductor/ble-sdk-arduino/blob/master/documentation/libraries/BLE/nRF8001-Porting-ACI-Library.md and watching the nRF8001 video from https://developer.bluetooth.org/DevelopmentResources/Pages/Webinars.aspx

    And thank you, it seems to be the direction to go to. I'm going to make the changes, and re-implement SPI and the delays using timers. I'll try using the basic example and then UART example, primarily since the UART example lets me use Nordics App. After using nRFstudio, theres a little batch file to make the appropriate headers, which is really helpful. I hope that works after a few hours of tweaking. Some of the Bluetooth protocols I'm not so sure off, like setting up the proper UIUD for different applications like a heart beat sensor, and what to use where. All a bit overwhelming. But I think its a definite start. The Reference manual is really informative, and helped me actually set up the device electrically and to know all the different commands there are, so thanks for that recommendation.

  • Yes, those examples are from SDK which needs serial key to be unlocked. BUT having product specification it is also possible to make it work, as every command is well detailed. Having some starter-kit although saves lots of work and gives better overview how those app are designed to work.

    Don't worry about those UUID's at the beginning, - You'll understand them later.

    also, protip: Non-volatile configuration can be written only once to nrf8001 - be careful which of these little batch files You choose to send, because once You write configuration to NVM it will stay there. But of course it doesn't make Your device useless, it just changes the default startup settings, which You can manually change in setup mode.

Related