Arm Mbed OS support forum

ICSP connection on Nucleo boards

Can anyone help me about of my project, I am using Stm32 Nucleo-F303RE and I want to communicate with USB Host shield ( MAX3421E). I’m having trouble communicating with this, Is there a ICSP (In-Circuit Serial Programming) pins to the Nucleo-F303RE so that I can communicate with the module.

-Is USB Host Shield(MAX3421E) compatible with the Nucleo-F303RE or other Nucleo boards like F401RE?? or Not??
-Is there a ICSP(In-Circuit Serial Programming) pin on the Nucleo boards?

Hello Declin,

I don’t have any experience with a MAX3421E shield yet, but according to this info the module is equipped with an SPI interface. So you should be able to communicate with it for example over pins D11, D12, D13 (MOSI, MISO, SCK).

The NUCLEO-F303RE (STM32F303RE chip) is equipped with ICSP interface too. But I think that is to be used to program the chip rather than to communicate with peripherals.

Best regards, Zoltan

How can I communicate with it? I already done connecting the SPI interface of the two boards but nothing happen, different errors. I think the nucleo board and USB Host Shield is not compatible with each other. Any suggestions of other USB Host board? Or do you have a code that can communicate with it?

I’ve done so many research about it, I soldered the wires , I research possible library and codes of it, but it doesn’t work. You have any suggestions of this? please let me know.

Hello Zoltan,

May I have your email? I need some help to build this project.

Hello Declin,

Sure, I’ll try help you as much as I can. However, I don’t want to lock others out. Perhaps one could find these posts useful and others can help you too. So I’d prefer to keep it public (I hope you don’t mind).

  • I searched the Internet for the MAX3421E shield and found this Arduino site. It says that the Arduino communicates with the MAX3421E shield using the SPI bus (through the ICSP header). Unfortunately, the NUCLEO board doesn’t have such ICSP header (connected to SPI pins). That’s why you have to communicate over the NUCLEO’s D11, D12 and D13 pins. I don’t know which version of MAX3421E shield you have but the one shown here (based on the PCB pictures provided) doesn’t seem to have the D11, D12 and D13 pins connected to the MAX3421E’s SPI pins. Consequently, stacking the shield on top of the NUCLEO board will not assure a correct connection. You have to connect the SPI pins available at the shield’s ICSP connector to the NUCLEO’s D11, D12 and D13 pins over flying wires. In addition, you need to select also a pin for CS (chip select) function and connect it the shield too.
  • The site mentioned above provides a link to this Arduino library. So I think the fastest way to make the communication work is to adapt the library to mbed SPI API.

Best regards, Zoltan

Here is my sample of wiring, I Already do the wiring between the spi interface of usb host shield and nucleo board, but it seems that it is not working , all i need is a working library for nucleo to interface the usb host shield.

Hello Declin,

You can find my attempt to port the USB_Host_Shield_2.0 library to mbed OS 2 here. An example of using it is here. Since I don’t have a MAX3421E USB shield I was not able to test it. Maybe it can help you get started.

Best regards, Zoltan

Hello Zoltan,

Thanks for helping, I’ll test it. I’ll let you know the result when I’m done testing it.

Hello Zoltan,

Sorry to bother you again, But it seems that your code and library have an error. Here is the error message,See attached screenshot.

Sorry I don’t know the coding of this, I’m new on mbed and this is my first project on the Nucleo board. I’m so sorry to bother you.

Hello Declin,

It compiled fine for the NUCLEO-F446RE target but there was a name clash with the declaration of the USB peripheral in mbed/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303xE/device/stm32f303xe.h file. I have renamed USB to Usb in the library and also in the main.cpp file. Delete the existing program from your online compiler and import the new one. It should compile also for the NUCLEO-F303RE target.

Best regards, Zoltan

Hello Zoltan,

I’m done compiling the code and its success, I just receive an email about the code that is updated.

According to my wiring that I sent to you, the connections between the LCD and nucleo board, here is my code.

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

Is it okay if I add that to the mbed compiler? That’s from Arduino ide code .

Hello Zoltan,

I already tested the code, But it seems that the data transfer from USB Host to the nucleo board is an error, Everytime I scan a barcode it cannot decode the data. I cannot get the data of the barcode.

What should I do? It seems that the decoding part of the usb host is the problem.

Hello Declin,

According to my wiring that I sent to you, the connections between the LCD and nucleo board, here is my code:
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

That code won’t work with Mbed.

To use LCD display with mbed have a look at:
https://os.mbed.com/components/HD44780-Text-LCD/
https://os.mbed.com/users/wim/notebook/textlcd-enhanced/

But before you start building new programs I’d suggest to first make the demo work.
Does the https://os.mbed.com/users/hudakz/code/UsbHostMAX3421E_Hello/ program work? What does it display on the connected PC’s serial terminal?

Best regards, Zoltan

It compiled to nucleo board but nothing display

Should I add the library of the LCD? what would be the connection? RS = D13 , E = D12 , RW = GND ? Is that correct?

Hello Zoltan,

I have encountered an error when I use serial monitor, This is the reason that my nucleo board cannot receive data from scanning of barcodes

See it here the error :
https://armmbed.github.io/mbedos-error/?error=0x80FF13D

Hello Declin,

It seems you run on Windows 7. To use a serial monitor you need to install a serial driver to your system. Once installed, connect your NUCLEO board to the PC and open the device manager. You should see a new mbed virtual serial COM port. Launch your favorite serial terminal program (Termite, TeraTerm or similar) and connect to the mbed virtual serial COM port. Make sure you select the 9600 bits/s speed.

Best regards, Zoltan

Hello Zoltan,

I’ve already done that, Someone replied to my other post and it said that " It is a bad memory manipulation" How can we solve that issue?
It says here, https://armmbed.github.io/mbedos-error/?error=0x80ff13d. I think Mbed doesn’t support this issue yet.

Hope you could help me with this. I think something’s wrong with the code or library. It cannot read the inner side of the nucleo board or driver cannot read data from the usb host to the nucleo board.

Best Regards, Declin

Hello Zoltan,

Have you tried your current code and library with a barcode scanner on it? please let me know.

I think the library couldn’t make communication while using a barcode scanner, I tried it without LCD , I tried using the serial monitor Tera Term and an error occurred, see the link on my previous email to you.

Hope you can help me make it work, Thanks.

Best regards, Declin

Hello Declin,

Unfortunately, I have neither a MAX3421E-based USB host shield nor a barcode scanner. So I’m not able to test the code.

Best regards, Zoltan