Analogwrite not working properly

Hi, I have an RAK3172 and I simple put a 1k resistor with LED to test my code. digitalwrite can blink the led but analogwrite can not why?

#define LED 21  //PB5 or WB_IO1 

void setup() {
  // put your setup code here, to run once:
  pinMode(LED, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
//not working there is no change on led

  for(int i = 0; i<255; i++){
    analogWrite(LED, i);
    delay(50);
  }
/*
// this is working and led blinking
  digitalWrite(LED, true);
  delay(1000);
  digitalWrite(LED, false);
  delay(1000);
*/
}

somebody please help!

Tested on PA0 (I have no setup where I can use PB5 for PWM).
It works fine.
How is the LED connected to the pin?

My test code:

void loop()
{
	volatile int i = 0;
	for (i = 0; i < 255; i++)
	{
		analogWrite(LED_GREEN, i);
		delay(10);
	}
	// delay(100);
	for (i = 255; i >= 0; i--)
	{
		analogWrite(LED_GREEN, i);
		delay(10);
	}
	delay(500);
	// api.system.sleep.all();
	// api.system.scheduler.task.destroy();
}

no, not working

void setup() {
  // put your setup code here, to run once:
  pinMode(PB5, OUTPUT);

}

void loop()
{
	volatile int i = 0;
	for (i = 0; i < 255; i++)
	{
		analogWrite(PB5, i);
		delay(10);
	}
	// delay(100);
	for (i = 255; i >= 0; i--)
	{
		analogWrite(PB5, i);
		delay(10);
	}
	delay(500);
	// api.system.sleep.all();
	// api.system.scheduler.task.destroy();
}

this is only working with same condition:


void setup() {
  // put your setup code here, to run once:
  pinMode(PB5, OUTPUT);
}

void loop() {
  digitalWrite(PB5, 1);
  delay(2000);
  digitalWrite(PB5, 0);
  delay(2000);
}

this is simple board