PermissionError: [Errno 13] Permission denied: 'cmd.jlink'

Hi there, I want to solve this problem
'PermissionError: [Errno 13] Permission denied: 'cmd.jlink''

i have a arduino uno board with Infineon pressure sensor
Infineon pressure sensor document

i also do the connection like this

[Error message]

Traceback (most recent call last):
  File "C:\Users\Documents\ArduinoData\packages\Infineon\hardware\xmc\3.1.1/tools/xmc-flasher.py", line 264, in <module>
    parser()
  File "C:\Users\Documents\ArduinoData\packages\Infineon\hardware\xmc\3.1.1/tools/xmc-flasher.py", line 259, in parser
    args.func(args) 
  File "C:\Users\Documents\ArduinoData\packages\Infineon\hardware\xmc\3.1.1/tools/xmc-flasher.py", line 218, in parser_upload_func
    check_device(args.device, args.port)
  File "C:\Users\Documents\ArduinoData\packages\Infineon\hardware\xmc\3.1.1/tools/xmc-flasher.py", line 149, in check_device
    device_value = get_mem_contents(master_data[device]['IDCHIP']['addr'], master_data[device]['IDCHIP']['size'], device, port)
  File "C:\Users\Documents\ArduinoData\packages\Infineon\hardware\xmc\3.1.1/tools/xmc-flasher.py", line 117, in get_mem_contents
    jlink_cmd_file = create_jlink_mem_read_command_file(addr, bytes) # todo: comes from proper metafile
  File "C:\Users\Documents\ArduinoData\packages\Infineon\hardware\xmc\3.1.1/tools/xmc-flasher.py", line 66, in create_jlink_mem_read_command_file
    with open(cmd_jlink,'w') as f:
PermissionError: [Errno 13] Permission denied: 'cmd.jlink'
PermissionError: [Errno 13] Permission denied: 'cmd.jlink'

Hi @mmmmin.

The "Infineon's XMC Microcontroller" boards platform is for use when you are programming one of Infineon's microcontroller development boards:

https://github.com/Infineon/XMC-for-Arduino#supported-microcontroller-boards

You should not use that boards platform when you are programming an Arduino UNO R3 board that is connected to an Infineon sensor module. Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus and then try uploading the sketch to the Arduino UNO board again. This time you will not encounter that "Permission denied" error.


Even though it is fortunately not relevant to @mmmmin, since I did some research on the subject before realizing this, I'll add a note tor anyone who actually is using an Infineon microcontroller development board and encounters this error: The bug has been reported to the developers of the "Infineon's XMC Microcontroller" boards platform here:

The person who submitted the bug report says they were able to work around the problem by starting Arduino IDE via "Run as administrator":

https://github.com/Infineon/XMC-for-Arduino/issues/266#issuecomment-1918038295

Please add in the documentation that the Arduino IDE needs to Run as administrator in order to use the XMC-flasher.py.

However, this is not really a good idea since we should be able to use a platform without giving the application administrative permissions.

There is an explanation of the bug in the script that causes this error here:

https://github.com/Infineon/XMC-for-Arduino/issues/266#issuecomment-2270570394

As a workaround, you can either install Arduino IDE under a folder that is not subject to special security restrictions (e.g., C:\arduino-ide), or else start Arduino IDE from a folder that does not have special security restrictions.

Thanks for your replying!

After select Arduino Uno board for uploading, "Permission denied" isn't come out anymore

but, I can't get any values (temp, prs)
through the serial monitor i can get only "Init FAILED! ret = -2"

#include <Dps368.h>

// Dps3xx Opject
Dps368 Dps368PressureSensor = Dps368();

void setup()
{
  Serial.begin(9600);
  while (!Serial);

  //Call begin to initialize Dps3xxPressureSensor
  //The parameter 0x76 is the bus address. The default address is 0x77 and does not need to be given.
  //Dps3xxPressureSensor.begin(Wire, 0x76);
  //Use the line below instead to use the default I2C address.
  Dps368PressureSensor.begin(Wire);

  //temperature measure rate (value from 0 to 7)
  //2^temp_mr temperature measurement results per second
  int16_t temp_mr = 2;
  //temperature oversampling rate (value from 0 to 7)
  //2^temp_osr internal temperature measurements per result
  //A higher value increases precision
  int16_t temp_osr = 2;
  //pressure measure rate (value from 0 to 7)
  //2^prs_mr pressure measurement results per second
  int16_t prs_mr = 5;
  //pressure oversampling rate (value from 0 to 7)
  //2^prs_osr internal pressure measurements per result
  //A higher value increases precision
  int16_t prs_osr = 2;
  //startMeasureBothCont enables background mode
  //temperature and pressure ar measured automatically
  //High precision and hgh measure rates at the same time are not available.
  //Consult Datasheet (or trial and error) for more information
  //int16_t ret = Dps3xxPressureSensor.startMeasureBothCont(temp_mr, temp_osr, prs_mr, prs_osr);
  //Use one of the commented lines below instead to measure only temperature or pressure
  //int16_t ret = Dps3xxPressureSensor.startMeasureTempCont(temp_mr, temp_osr);
  int16_t ret = Dps368PressureSensor.startMeasurePressureCont(prs_mr, prs_osr);
  
  //ret : 


  if (ret != 0)
  {
    Serial.print("Init FAILED! ret = ");
    Serial.println(ret);
  }
  else
  {
    Serial.println("Init complete!");
  }
}



void loop()
{
  uint8_t pressureCount = 20;
  float pressure[pressureCount];
  //uint8_t temperatureCount = 20;
  //float temperature[temperatureCount];

  //This function writes the results of continuous measurements to the arrays given as parameters
  //The parameters temperatureCount and pressureCount should hold the sizes of the arrays temperature and pressure when the function is called
  //After the end of the function, temperatureCount and pressureCount hold the numbers of values written to the arrays
  //Note: The Dps3xx cannot save more than 32 results. When its result buffer is full, it won't save any new measurement results
  //int16_t ret = Dps368PressureSensor.getContResults(temperature, temperatureCount, pressure, pressureCount);
  uint16_t ret = Dps368PressureSensor.startMeasurePressureCont(pressure, pressureCount);
  if (ret != -2)
  {
    Serial.println();
    Serial.println();
    Serial.print("FAIL! ret = ");
    Serial.println(ret);
  }
  else
  {
    /*
    Serial.println();
    Serial.println();
    Serial.print(temperatureCount);
    Serial.println(" temperature values found: ");
    for (int16_t i = 0; i < temperatureCount; i++)
    {
      Serial.print(temperature[i]);
      Serial.println(" degrees of Celsius");
    }
    */

    Serial.println();
    Serial.print(pressureCount);
    Serial.println(" pressure values found: ");
    for (int16_t i = 0; i < pressureCount; i++)
    {
      Serial.print(pressure[i]);
      Serial.println(" Pascal");
    }
  }

  //Wait some time, so that the Dps3xx can refill its buffer
  delay(10000);
}

i using this code to get the pressure values

what should i do to solve this error...?

That is good progress at least!

Unfortunately I don't have any experience with the XENSIV™ DPS310/368
Pressure Sensor 2Go Kit and I don't have access to this hardware so I'm limited in what I can do to help with this new problem. However, I do notice this:

This means the library communicates with the sensor using the I2C interface of the Arduino UNO board. The I2C is on pins A4 and A5 on the UNO R3 board:

However, your wiring diagram shows you have the sensor connected to pins A2 and A3 on the UNO board:

So you should carefully study the documentation for the sensor and for the "Dps368" library, then review your circuit to make sure it is correct. If you need to make any adjustments to the circuit, make sure to disconnect the USB cable of the UNO first to avoid any "magic smoke" incidents.

After that, plug the board back in and check the Serial Monitor. Hopefully this time it will be able to initialize the sensor and read data from it.

Thanks for your advice :grinning:

unfortunately, the level shifter that i got was UART
But, DPS368 (pressure sensor) has only I2C & SPI examples
I think that's the point of error I'm missing
So, i'll gonna get other Bi-level shifter

I really appreciate your help, I wouldn't have been able to work it out without your help

You are welcome. I'm glad if I was able to be of assistance. I hope that your plan to replace the level shifter will resolve the problem. You are welcome to report back here on the results.

Regards, Per