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

Lost in 52832 land.

SALSProbe.inoSALSProbe.zip

I have attached an Arduino INO file that I wrote early on in a project.  It runs a probe.  It is an amazingly simple probe but especially important.  I am making a simple opacity sensor for blind chemistry students.  It has a glass tube with a resistor at the end.   It used to have a RedBear with an NRF52 chip   inside the handle with a battery.  The data was sent to an IOS app and blind students could store their received data in the app.  We were getting close to releasing the probe because it is not an extremely accurate device it is just for blind students to tell if the liquid is getting lighter or darker.      I was happy to be able to make it with Arduino because as you will see from the INO file I have attached It was not hard to make.  I will mention at this point that I am also 100% blind and have been working as a Software Engineer and project lead for quite a while. 

 

If you get my SALSProbe.zip file that I have attached you will see I have started remaking the INO to fit the nrf52832 chip because I had to have our engineers design me a replacement board since the RedBear is no longer made thus the support is gone for the Arduino IDE.  I have seen Arduino support for the NRF 52832, but I have not been able to get my board to work with the IDE>

 

So, I have downloaded the NRF SDK version 16.  I have also gone through many tutorials and have started down the path to making the INO file I have attached into a nrf52832 project with the rfx ski.  I am running into problems because many of the samples of how to do things I want to do are made for older SDK’s  This attached version is just my 4th attempt at starting and I am already running into trouble. 

 

I am running into accessibility issues.  For example, the new J-link tools are not accessible with my screen reader, so I am finding it hard to read the log information.  This causes problems because I cannot find out what ram values, I need to set to get my custom characteristic working.  Not to mention I am adding the battery service and still need to add the info service I used to have.  So that ram value will change a few more times.

 

 

Note I do know there is an NRF ble uart service but because the IOS app was already written to use the method the old Arduino libraries used I do not want to have to change the IOS app.  So, I am trying to create my own characteristic like in the old INO file.

 

I am failing terribly.  I only sent my embarrassing code in SALSProbe to show I am trying.  I am not asking without doing first.

 

Where I am now.  I have a start.  I have added a custom service with one characteristic.  I must change it to send 5 bytes though and I also need to make sure the battery service is working.  I still need to add the info service and I need to add the code where it will read from p0.04 which is a bit confusing to me.    I have tried reading the ad value but everything I have read is for older NRF and my code fails.  That code is not in this zip file but I could dig it up if after seeing this mess you think it will help.

I know I must use SADC sample but the more services I add the les my code runs. There is something wrong with my current code because it is not advertising its name or the characteristic.  It was showing the name at least before I added the custom characteristic. 

 

I think that is because I can’t see the log warnings telling me to expand the ram in the config.  If I could see it, I would set it in the config file.  If anyone has a way to log the chip logs to the command line rather than to the not accessible J-link viewer please let me know

 

.  I have also tried to use the rfx connect tools on my iPod and Android devices, but they are just barely accessible, and I have not been able to see the log files there either.  That could be a setup issue, or it could be the apps are just not accessible.

 

So here is my question after all that.   Is there someone out there that can help me or is there someone out there that can quickly convert my INO file to work on the NRF 52832 chip using the NRF 16 SDK?

I know if I were still sighted, I could pop up the Secure IDE and figure this out but as it is, I am failing, and I have been working on this for weeks.     If you think you can do it and do not want to do it for free.  I am desperate and we might be able to work something out.    I would like to get this built and out to the blind kids for when school starts up in September. 

 

Any help is greatly appreciated.

 

Sometimes I think it would be easier to go back to using Assembler.  When I coded in Assembler I didn’t have all this unaccessible GUI stuff.

 

Anyway if you have got this far thanks and again thanks for any help.

 

 

Parents
  • For example, the new J-link tools are not accessible with my screen reader

    There are command line versions of these SEGGER programs, e.g. using JLinkGDBServerCL.exe should get rid of those unreadable UI elements.

    I think that is because I can’t see the log warnings telling me to expand the ram in the config.

    Use the above JLinkGDBServerCL to flash and run your program (with arm-none-eabi-gdb, target is localhost:2331). Then connect to the RTT port via telnet client, host is "localhost" and port is 19021 (telnet localhost 19021).

    Both nordic command line tools and SEGGER are available for Linux, this might be simpler to setup with reader or Braille display.

    There is unfortunaltely no quick way for converting your .ino into an SDK program (that I know of). And no, you don't want to program an ARM Cortex-M in Assembler. These are meant to be programmed in C.

  • First I want to thank you because I forgot to in my last reply.  Thanks for the command line debugger.  I had not seen that one.   I still have not got it to work yet for either the logs or GDB.  I think if I can get the debugger working the logs will work.  Here is what I ahve tried

    I have got the jlinkgdbservercl working with:

    jlinkgdbserver -device nrf52832_xxaa -if swd -port 2331

    I usd telnet with the port you posted.  All seems to connect correctly.  Other than the connection messages I get nothing else.

    I Then try to compile my program with debugging 

    I changed the opt line from -O3 -g to

    -O0 -ggdb

    I also tried just g alone but I found -ggdb as an option on one of the documents I was reading on line.  Neither of them seem to create a .elf file and the hex file it does produce does not have debugging symbols at least when I do

    arm-none-eabi-gdb SALSProbe.hex

    It says there are none.  Everything I read says it should make an elf file but it doesn't.  Can you or anyone tell me what my possible problem is?  My Makefile is in the original zip file of the question and all I changed was the opt lines.  Is there something else I need to change?

    ken

  • It doesn't look like that will work.  According to the Secure link you sent it only works for the pro and up versions of JLink.  Iam using the education version right now.  I will have to see if I can get one from work.  They might have a JLink pro that is sitting idle. 

    Will the old way with PRIMask and changing break points work with the JLink education version?

  • The SoftDevice will assert if any timings are missed, I don't see how you can get around that when a CPU gets halted in a breakpoint. 

    You can evaluate MMD with the nRF52 DK's onboard J-Link, but you can't use it to develop a product. You can ask Segger directly whether "evaluation" covers your use-case or not. Anyways I suggest that you try out MMD on our DK as it is a good debugging tool in general that works with all Cortex-M processors.  

  • I had read their policies.  WE purchased a few at work but According to their license if it is for non-profit and I am not making money on it I could use this.  I will write them though.  Fact is the only reason I am not using a pro one is I have not been into the office since the Corona craziness.    

    With that said I guess I could be using the raspbury pi to do this rather than Jlink.  

    My question is which DK should I get for NRF52832 and where is the best place to buy it?

  • MMD only works on J-links as far as I know. The debugger changes the breakpoint, single-step, and halt CPU commands into an IRQ, I don't know of any other debugger that does this except Segger, though I have not looked, as Segger is what we use.

    For the nRF52832 you can use many of the nRF52 DK's, but I recommend that you get the PCA10040 as that has the 52832 on it. 

  • I will take a look at the board with the NRF52832 on it.  With that said my code is now running.  It for sure is not done.  I will probably remove the need for the softdevice until everything else is working or until my boss swings buy and rops off the other J-link.  With that said I should be able to see the logs right?  I can step through the code and print values but it would be nice if I can just watch the logs scroll buy on the command line.  Are the logs supposed to show up in the telnet localhost 19021?   I haven't seen a log yet but then I just got it fully compiling and running just now.  If I am right and the logs are supposed to show up in Telnet then I am all good.

    I will pop back in here if the logs don't show up.

Reply
  • I will take a look at the board with the NRF52832 on it.  With that said my code is now running.  It for sure is not done.  I will probably remove the need for the softdevice until everything else is working or until my boss swings buy and rops off the other J-link.  With that said I should be able to see the logs right?  I can step through the code and print values but it would be nice if I can just watch the logs scroll buy on the command line.  Are the logs supposed to show up in the telnet localhost 19021?   I haven't seen a log yet but then I just got it fully compiling and running just now.  If I am right and the logs are supposed to show up in Telnet then I am all good.

    I will pop back in here if the logs don't show up.

Children
  • The J-link's user guide states: " Default [Telnet] port is 2333"

  • NRF Logs are put on the RTT port 19021 and not on the telnet port 2333.

  • I want to thank both of you for all your replies.  I still would love to pay someone to just do this quicker than I can but after your answers I have now got my custom NRF52832 board running with the GDB server and I can see the logs as well as be able to use the GDB with break points which makes  my life better.  

    I spoke with the J-link folks and because of my company being NOn-profit and the fact that we don't make a dime off of what we build.  They said they don't have a problem with me using he Mini.  I still will be ggetting one of our J-link pro's from work next week when the boss goes on a delivery run.  

    Before that happens though since you clearly explained why I can't debug the way I wanted I have broke my project up into all the services as modules and I am going to test all the ones that have nothing to do with softdevice and Ble.  If all 4 of the other parts of the project work.  I have a good feeling about being able to quickly put them all together and test them with BLE.

    In short.  Thanks for all the help and unless the world goes even crazier.  We can probably close this Q&A.  Of course if someone wants to jump in and say they will do it for a few hundred bucks I will step away and run for one of the big Applications I am working on.

    Ken

  • OK I do have another question.  I am using the SAADC example from the SDK peripheral section of examples.  I have compiled it for my Raytac MDBT42Q module which has an NRF52832 chip as its core.  I have read the PDF on the Raytac module and it has chip pin 17 attached to P0.04 AIN2.  

    I have changed the Saadc  to use AIN2.  I ran the code and watched the output in the log.

    I have a photo resistor attached between VIN of the board to the P0.04(AIN2)

    I expected to see values from 0 to 1024 because the resolution is set to 10 bit.  This is what I see on my original Arduino INO sketch.   

    I am not seeing values from 0-1024.  I am seing a few values ranging from -1 to -8. 

    Again I have changed nothing in the SAADC but the AIN2.  So my question is how do I get this to give me values I am expecting.  Is this some kind of big little indian problem or  what am I seeing in this buffer.

    Note if I change the AIN to values of other pins that I have nothing attached to.  The log shows me values like 16,18,17 in the buffers. 

    So I am a bit confused at what the samples are.  I have read as much as I can find on this and I am confused.

  • Have you sampled a known reference voltage and compared the output of the ADC?

Related