7 years, 6 months ago.

Porting prototype software not working

Hi,

i am finished developing a software based on mbed NucleoF410RE also developing the PCB based on the components i have tested on the nucleo board. On the developed pcb i have used same MCU hoping that the software and components that worked on nucleo will also work on the pcb when using the same pins but it seems that not everything works as expected.

Here the concrete example: i am using this lib: https://developer.mbed.org/users/Blaze513/code/SDCard/file/ddf09d859ed7/SDCard.cpp to write and read data from a sd card.

initialisation is done as follows

SDCard memory(PA_7, PA_6, PA_5, PA_4, "sd");

and i am trying this 2 code blocks

pc.printf("sector count: %d\n", memory.disk_sector_count());

and

        int pageCountToManipulate = 1;
	unsigned int address = 0;
	int PAGE_SIZE = 512;

	//READ
	pc.printf("READING per single page...\n");
	unsigned char * bufferToReadInto = new unsigned char[PAGE_SIZE*pageCountToManipulate+1]();
	unsigned char readResult = memory.Read(address, bufferToReadInto);
	if (!readResult.empty()) {
		pc.printf("ERROR READING <%02X>\n", readResult);
	} else {
		pc.printf("I READ:\n %s <%d bytes>\n", bufferToReadInto, sizeof(savedData));
	}

	pc.printf("DONE\n");

what i am getting on the developed PCB is:

sector count: 0
READING per single page...
ERROR READING <04>

Now i am wondering, how come that same MCU and same pins work on nucleo but do not work on my board. I have rechecked many times the connected pins and i am sure the connections are right. I do not know what to check anymore.

Is there something one should do when developing a pcb and using the same mbed software? Does anyone know where didn't i pay attention?

EDIT: Based on Bills comment i checked the voltage on each pin on the card (the same cardholder i connected to nucleo than removed and connected directly to the PCB). The only pin that was not showing the same voltage was the sclk, On nucleo it showed 0v and on pcb it showed 3.3v. Where does this difference come from? What can i do to make the voltage the same, is that something the MCU controls or is it something wrong on the HW or is that something that should be configured through the software?

Another thing: When searching on mbed with "porting mbed" i can find a lot of sites which explains steps for doing things. Now i am confused. If i use same pins do i need to port anything on the software side or should it work on my pcb as it worked on nucleo?

When I see things that don't make sense I break down the problem into pieces. Start by writing a simple loop. Declare the pin that you have for SCK as a DigitalOut and make it wiggle very slowly. Do this with each signal that you are using for the SD card interface and once those are working correctly then start adding back in real code. I would start with the mbed SPI class and just send a fake message over and over. If that works I would try adding back in the SDCard class and see what breaks.

posted by Bill Bellis 04 Oct 2016

2 Answers

7 years, 6 months ago.

Same pins and same code should work without problems, assuming the rest of the hardware is identical. Note that there is an LED connected (LED1) to the SCK pin (PA_5) on the nucleo. See pin diagram here and nucleo schematic. Declaring one of the mbed LEDx in your code as DigitalOut may override the SCK function declaration and pull down the SCK/LED pin. The connected LED may also load the pin a bit and pull down the logic level.

Accepted Answer
7 years, 6 months ago.

Let's assume the CPU side is correct. Check the SD Card side. Power, Card Select, Write Protect. Also each socket vendor moves the PCB pins around so double-check the footprint very carefully.

Hi Bill, thanks for the answer. Please have a look at my edit above.

posted by anteo c 03 Oct 2016