As per my knowledge, the way you are calculating the trainPerformance, valPerformance & testPerformance may not be correct. Instead I would suggest that you can make use of tr.trainInd, tr.valInd & tr.testInd instead of tr.trainMask, tr.valMask & tr.testMask as follows:
trainPerformance = perform(net,t(tr.trainInd),y(tr.trainInd))
valPerformance = perform(net,t(tr.testInd),y(tr.testInd))
testPerformance = perform(net,t(tr.valInd),y(tr.valInd))
Then w.r.t performance function, according to your above code the performance function you are using is 'crossentropy' and hence perform(net,t,y,ew) returns network performance calculated according to the net.performFcn which is 'crossentropy' & not 'mse'.
Also for your additional part, you may have to use
trp = crossentropy(net,t(tr.trainInd),y(tr.trainInd),{1},'regularization',net.performParam.regularization,'normalization',net.performParam.normalization)
and not
trp = mse(net,trainTargets,y)
Best Answer