platformio / platform-atmelsam

Atmel SAM: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelsam
Apache License 2.0
78 stars 105 forks source link

Error: Couldn't find a board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload. #135

Open ashishsk opened 3 years ago

ashishsk commented 3 years ago

Configuration

Operating system: Windows10

PlatformIO Version (platformio --version): PlatformIO, version 5.0.3

Description of problem

I bought new boards and I have been unable to upload any code to these boards: Adafruit Feather M4 Express and Arduino Due. I tried to verify it wasnt the problem with the board hardware by trying a different Feather M4 Express boards (all new) and the error still shows up.

Error:

Feather M4 Express: image

Due: image

Similar issue may have been reported here but that should have already been solved. https://github.com/platformio/platformio-core/commit/a6078b78bf1d8ff8542c8930f54b5490f687e5a4

Steps to Reproduce

Actual Results

Expected Results

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:adafruit_feather_m4]
platform = atmelsam
board = adafruit_feather_m4
framework = arduino
lib_deps = 
    SPI
        CAN_BUS_Shield
monitor_speed = 115200
upload_protocol = sam-ba
upload_port = COM10
[env:due]
platform = atmelsam
board = due
framework = arduino
lib_deps = 
    SPI
    ;adafruit/Adafruit Zero DMA Library@^1.0.8
        ;seeed-studio/CAN_BUS_Shield @ ^1.20
        ;CAN_BUS_Shield
monitor_speed = 115200
upload_protocol = sam-ba
upload_port = COM10

Source file to reproduce issue:

//Send

#include <mcp_can.h>
#include <SPI.h>

MCP_CAN CAN(9);                                      // Set CS to pin 10

void setup()
{
    Serial.begin(115200);

START_INIT:

    if(CAN_OK == CAN.begin(CAN_500KBPS))                   // init can bus : baudrate = 500k
    {
        Serial.println("CAN BUS Shield init ok!");
    }
    else
    {
        Serial.println("CAN BUS Shield init fail");
        Serial.println("Init CAN BUS Shield again");
        delay(100);
        goto START_INIT;
    }
}

unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
void loop()
{
    // send data:  id = 0x00, standrad flame, data len = 8, stmp: data buf
    CAN.sendMsgBuf(0x00, 0, 8, stmp);
    delay(100);                       // send data per 100ms
}

Additional info