I am trying to control 11 SPI based Digital Potentiometers (AD5292) through Arduino Mega 2560 which is in turn controlled by Matlab. I have installed the MATLAB Support Package for Arduino Hardware so that I can control my Arduino through the GUI I have created in Matlab. According to Arduino, the PINs for SPI are 50(MISO), 51(MOSI), 52(SCK) and 53(SS), this PIN 53 is the slave select pin and is only needed when I am using my Arduino as an SPI slave, when I am not using my Arduino as an SPI slave (like in my case) I can use PIN 53 as a constant digital output. When I try to use SPI while PIN 53 configured as Digital Output, Matlab gives me an error "Board Mega2560, SPI communications require pins D53(MOSI) which is currently in use. To use SPI, configure them to 'SPI'". When I have not configured PIN 53 at all (no configuration and no connection to this pin) my SPI devices work fine (which shouldn't be the case if PIN 53 was MOSI). My question is why does Matlab thinks that PIN 53 is MOSI and how can I solve this problem?