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

Migrating from arduino to NRF32 platform Using the SES IDE and TWI interface OLED display

Hello, 

I'm trying to start working with the NRF52832 Dev board for quite some time and can't manage to get anything complex done other than blinking an LED and even that can't be achieved without using one of the pre build examples sins it's super hard to start with a blank file and import a library somehow so that is a huge challenge doing that without any proper tutorials what so ever for that very different platform of SOC NFC,Bluetooth and MCU

So before I start I'd love to hear about any proper tutorial series you guys have heard about.

Now I've made a simplified code in arduino that sets the display up and invert the colors in the screen every 500ms and when I run it with my arduino every thing goes great but after moving it to the SDK on SES to the TWI_sensor example making the equivalent modifications and building it without errors the display doesn't seem to respond and when debugging the code seems to run smooth somehow and stopping at the right breaking points.

BTW there's no way it's a wiring problem sins I'm using it with a shield and chcked that the MCU can read it with the TWI_scanner example.

Here's the SES Code:

 

And the working arduino Code: 

Some side questions:

1) What's the easiest way to start a code from blank 

2) How to prevent SES from auto saving? every thing I open and mess up a little it gets saved after quitting and then corrupting the file. 

  • Hey Mike,

    I'm glad that you've taken the BIG step into embedded engineering. I know It seems incredibly daunting right now as the transition from the Arduino world into the embedded realm is the developer/maker/tinkerer/students equivalent to the Ice-bucket challenge. 

    As you have probably noticed nothings seems to "work out of the box" and minuscule changes to seemingly unrelated code have disastrous consequences. Fear not, we've all been there (still am to some degree). The learning curve is steep, there is so much to learn, and you'll not know where to start. I will try to give you some advice and directions. 

     

    First off, you cannot focus entirely on you end goal, you need to take baby steps otherwise you will lose motivation and quit.

    You need to realize that a "simple" task of transmitting a single byte over I2C/TWI is a very complex operation dependent on a lot of variables, and if you make any assumptions along the way you will regret it later. My job is to chase down the root causes of our customers problems and I know from painful experience how an assumption like: "BTW there's no way it's a wiring problem since I'm using it with a shield and checked that the MCU can read it with the TWI_scanner example", will ruin your week/month. You need to know that the physical signal is transmitted and received correctly. To do that you need a digital analyzer. We've got a Saleae Logic Pro at every desk because we use them frequently, they are easy to use and they're good enough debug data lines at <10MHz. 

    There ARE defective products, no matter how simple or complex. Any product will have some small percentage(Parts Per Million) of units that have some sort of defect. It might be our MCU, or the OLED screen, or a power transistor on the OLED board, or a capacitor, or an inductor, or a connector, etc. 

    Once you have verified that something works as intended you can take a few moments and appreciate the fact that you are one step closer to your end goal, then start on the next step. Testing and verification is a critical component of engineering and it automatically breaks down tasks into small components. 

     

    Secondly, you will have to read, a lot. The nRF52832 Product Specification, the OLED display's datasheet, the nRF5 SDK v14.2.0 documentation and its API Reference, and code. Lots and lots of code. You will have to learn embedded C programming to understand what is going on inside the libraries and drivers. 

    You will find our tutorials at https://devzone.nordicsemi.com/tutorials. I suggest you delay doing anything BLE related until you have a better grasp of how to use our SDK documentation, libraries and examples.  

     

    Thirdly, you need to use some form of a Version Control system. I suggest Git for programming. This way you can modify your code and not have to worry about ruining your code base or project files. The Segger Embedded Studio project file itself is stored in clear-text which means that it can be processed and saved in Git. 

     

    Now to answer your questions:

    1. SDK14.2/examples/peripheral/TWI or TWIM. Use this example as a base to begin with. You might want to switch to another base as you gain more knowledge.
    2. Version control, version control, version control. Commit often, write good commit messages, use branches.  

    Cheers,

    Håkon.

  • Hello haakonsh,

    I've went through the Nordic docs countless times and make sure the specific components work with with that particular setup(Used arduino nrf52832 extensions and ST LINK V2 to program it even on my custom PBCs) the tutorial are not helpful either just explaining about how to setup the more complex stuff which I'm sure are easy when you get to that stage after you understand the basics and common idiology of this platform,

    Now going through every transistor that makes the IC and programming useful is not that useful either sins it simpley take way too many years I don't have.

    So for now I'm just striking that particular problem to be able to move more easily hopefully and integrate the rest and then add the more complex BLE,low power part of the software.

  • I'm not suggesting that you actually start by checking every transistor, etc. What you need to do is to start slow. Can you read the shields device ID?

  • Can you read the shields device ID?

    Yes Of course like I said at the beginning I just don't understand why that function doesn't work physically according to that code. the arduino POC algorithm that got converted to SES with the nrf52832 just doesn't work as expected or is it just me not ready understanding that TWI read function properly.

  • Do you have a datasheet for the OLED screen?

     

1 2