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

Timer conflict(?) between UNO and nRF8001

Dear members!

I followed the tutorial of the nRF8001, and tried this code:learn.adafruit.com/.../nrf-uart-in-detail

It worked for me just fine, but...

I have an existing metal detector code for Arduino UNO that uses Timer0 and Timer1 and interrupts. just the metal detector alone also works fine.

Than I tried to merge the metal detector's code with the nRF8001 tutorial code, you can take a look at the result here: http://pastebin.com/eQAR6h6V

So my problem is that this is not working when they are merged, maybe some timer conflict? How can I set Timer2 to the SCK pin? Or something else is the problem? Once again, they worked individually just fine, but together...not.

This project is due 05-09 midnight, so its quite urgent, any help is appreciated!

Regards, TreasureHunter

  • Are you getting any indications why it is not working? Is BTLEserial.write called? what is returned from BTLEserial.write? etc...

  • As far as I can see the adafruite library isn't using any timer. Why do you suspect that this is a timer conflict?

  • When I run the program, it doesn't even reach the loop() cycle, because the serial.print("TEST3") doesn't print out at the beginning. I though it's a timer problem because nRF8001 uses a clock at SCK pin, so I though it needs a timer of some sort.

    I call BTLEserial.write in the end of the code, but we doesn't reach that, because it doesn't even starts to advertise.

  • I have heared about the bug that is somehow connected with newest IDE. As other people were saying (i have not experienced that by myself! maybe because i am not using arduino at all.) program may be stuck when you have USB cable plugged in board and serial monitor is closed. Could you try restarting serial monitor?

  • I tried the tutorial code again, it works fine, I then tried the code in the "pastebin" again, nothing.. I put a Serial.print("TEST"); before cli() in setup() stage, and put Serial.print("TEST1"); after sei().

    The result was: a "T" appeared in the serial monitor, nothing more.. so the problem must be between cli() and sei() with those registers or something.. I don't get it..

1 2