I have a problem with creating my software (not Nicla Boards)

Hi.

Sorry to post this topic here, but I hope I can get help here.

I have a PCB with the ANNA-B112 (not Nicla).
Below is part of the electrical diagram that I recreated myself.

ANNA-B112 has some firmware that causes the LED connected to P0.30 to flash. I managed to read the firmware using the ST-Link programmer and OpenOCD (to .bin file), then cleared the flash. The LED stopped flashing. I reprogrammed the ANNA-B112 with the same firmware that I had previously read and the LED started flashing again. This means that ANNA-B112 programming via the ST-Link programmer and OpenOCD works properly.

Now, as a way to start playing with ANNA-B112, I wanted to create my own program. I installed the required components in Arduino IDE (Arduino Mbed OS Nicla Boards). I wanted to write a program that would flash the same diode (on pin P0.30).
Below is the code:

#include "Arduino.h"
#include "NDP.h"

void setup()
{
    pinMode(A1, OUTPUT);  // A1 = P0.30 ???
}

void loop()
{
  digitalWrite(A1, HIGH);
  delay(500);
  digitalWrite(A1, LOW);
  delay(500);
}

I choose Sketch -> Export Compiled Binary and I get a .bin file. Then, using OpenOCD, I program the ANNA-B112 system with this file. The ANNA-B112 system seems to be programmed correctly, but after resetting its power supply, the LED does not flash.

Does anyone have an idea why this won't work?

HI, @adix3
Welcome to the forum.

56K might be a bit high as a current limiting resistor.
image

If your LED has a voltage drop of 1.6V and your controller output goes to 3V3, then using Ohms Law.
V = I * R and computing for 20mA LED current.

R = V / I = (3.3 - 1.6) / 0.02 = 85R, 86R or even 100R should make your LED light.

Did you try the 56K and the LED across the 3V3 first.

Tom.... :grinning: :+1: :coffee: :australia:

Thank you for your answer.

As I wrote earlier:

ANNA-B112 has some firmware that causes the LED connected to P0.30 to flash. I managed to read the firmware using the ST-Link and OpenOCD programmer, then cleared the flash. The LED stopped flashing.

So if I upload the original .bin (the one I read earlier), the LED blinks. But if I upload the .bin generated from the Arduino IDE, the LED does not want to blink.
So it's not an electrical problem.

P.S. Maybe someone could compile my code from the first post, upload it to their Nicla board, connect the LED to output no. 7 (P0.30) and check whether the LED will blink?

Anyone here who has a Nicla board? :slight_smile: