SPI Problem with Microchip Studio

Hi
I have some Problems with my SPI. As you can see in the picture from my logic analyzer below, the slave-select pin pulls low in the middle of a transmission. Does anyone know how things like that can happen? The wird thing is: Only happens when i use Microchip studios to upload the code to arduino, when i use the arudino ide to upload the exact same code, it works flawless.

this is my code
Would mean a lot to me if someone could help me

#include <SPI.h>
#include <Ethernet2.h>
#include <SD.h>
//Beginning of Auto generated function prototypes by Atmel Studio
//End of Auto generated function prototypes by Atmel Studio



// size of buffer used to capture HTTP requests
#define REQ_BUF_SZ   60

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0xA8, 0x61, 0x0A, 0xAE, 0x6D, 0xBF };

IPAddress ip(129, 129, 88, 87);
IPAddress gateway(129, 129, 88, 1);
IPAddress subnet(255, 255, 255, 0);

EthernetServer server(80);        // create a server at port 80
char HTTP_req[REQ_BUF_SZ] = {0};  // buffered HTTP request stored as null terminated string
char req_index = 0;               // index into HTTP_req buffer

void setup()
{	
	Serial.begin(9600);
        // start the Ethernet connection:
  Serial.println("Versuche IP Adresse zu reservieren");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // initialize the ethernet device not using DHCP:
    Ethernet.begin(mac, ip, gateway, subnet);
  }
  // print your local IP address:
  
  Serial.print("Meine IP Adresse: ");
  ip = Ethernet.localIP();
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(ip[thisByte], DEC);
    Serial.print(".");
  }
  Serial.println(" ");
   
    Ethernet.begin(mac, ip);  // initialize Ethernet device
    server.begin();           // start to listen for clients
}

void loop(){}

Do you just upload using Microchip Studio or also a recompile?

I have no experience with Microchip Studio; thinking that maybe a different library is used if you recompile.

All librarys get imported to microchip studios, so it should not be a problem. But i think it has something to do with the librarys

I doubt that Microchip Studio is able to handle Arduino libraries correctly. They depend on the Arduino environment which probably doesn't exist in the Microchip Studio.
That's comparable to compiling a Microsoft .NET project in Apple's XCode. You will probably fail even if you try to import the libraries.

There is a specific function implemented into Microchip Studios which allows you to directly import Arduino projects. Librarys get importet automatically.

I guess Microchip does the import wrong. Maybe they have a replacement library for Arduino's SPI library? Such import functions may work if you use only high level functionality but they usually won't work in all cases. Ask Microchip to fix that, it doesn't seem to be an error in the Arduino IDE.

I fixed it, it was the faulty logic analyzer. It was a bad cable setup so they were voltage spikes over the high level of it. Borrowed the oszi of a friend and looked at the signal. Just found out one hour ago that i had soldered the capacitors in the wrong way, what a stupid error that cost me like 1 week. But thank youf ro your replies

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.