cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent uploading a new sketch to a Nucleo board

Saint32
Associate II

 I hope this thread is posted in the right category.

I’ve been using Arduino boards for several years and am thinking of using a Nucleo 144 board (specifically, Nucleo-F207ZG) for a project. Once the project is completed, it will be serve as a permanent peripheral attached to a computer; serial data will be sent back and forth from the Nucleo to the computer. The computer will be running Windows 10.

In this setup, it will be important that the code uploaded to Nucleo can’t be overwritten or deleted. It will also be essential that the board won’t be recognized as a storage device in Windows.

I am completely new to Nucleo boards. Is there a way to prevent new sketches from being uploaded to the board? Is it possible to prevent the board being recognized as a storage device in Windows?

8 REPLIES 8
TDK
Guru

> Is it possible to prevent the board being recognized as a storage device in Windows?

The board has two USB connectors. The one you use to program (CN1) is connected to the onboard ST-Link chip. There is no way to modify how this behaves or how it shows up on your PC.

However, you can power the board from the other USB port. In this case, the board won't show up at all on the PC unless you have firmware that specifically implements a USB device.

> Is there a way to prevent new sketches from being uploaded to the board?

You can set RDP level 2 to prevent a program from being changed or read out. This process is not reversible. I do not recommend using it, but rather to reassess your need to prevent changes to the firmware.

If you feel a post has answered your question, please click "Accept as Solution".
Saint32
Associate II

>However, you can power the board from the other USB port. In this case, the board won't show up at all on the PC unless you have firmware that specifically implements a USB device.

@TDK​ thanks for the information. I have a couple of newbie follow-up questions:

After programming the Nucleo, could I break off the programming part of the board, and then use the other USB port to connect the Nucleo to the computer?

Would the connection using the other USB port (I think this is labeled CN13) allow for serial communication between the Nucleo and the PC?

Is there any way of (inadvertently) deleting a sketch on a Nucleo board that is only connected via USB/CN13? For instance, when using an Arduino Due, one can open and then close serial communication at 1200bps. This erases the flash memory on the Due. Are there any such methods of deleting a sketch on a Nucleo board?

TDK
Guru

> After programming the Nucleo, could I break off the programming part of the board, and then use the other USB port to connect the Nucleo to the computer?

Yes.

> Would the connection using the other USB port (I think this is labeled CN13) allow for serial communication between the Nucleo and the PC?

Generally not, but it's possible. You would need to implement a USB VCP serial port on the board firmware, which is nontrivial.

> Is there any way of (inadvertently) deleting a sketch on a Nucleo board that is only connected via USB/CN13?

Not really. If it was in bootloader mode, you could erase it using the DFU protocol. But it's not going to boot up in bootloader mode.

> For instance, when using an Arduino Due, one can open and then close serial communication at 1200bps. This erases the flash memory on the Due.

That sounds awful. Nothing like that here.

If you feel a post has answered your question, please click "Accept as Solution".
Saint32
Associate II

>Generally not, but it's possible. You would need to implement a USB VCP serial port on the board firmware, which is nontrivial.

As an alternative to enable serial communication between the Nucleo and the pc, is it possible to use a USB-TTL adapter and connect only the RX(D0) and TX(D1) of the Nucleo to the TX and RX of the TTL adapter?

This, of course would require the board to get its power independently of USB. Can the Nucleo be powered--for example--by a 5v transformer?

Yes, you can use a UART adapter.
The nucleo board has several power options including 5V input. They're covered in detail in the user manual.
If you feel a post has answered your question, please click "Accept as Solution".
Saint32
Associate II

>Yes, you can use a UART adapter.

Sorry to ask for clarification 🙂 , but with a UART adapter, could I break off the programming part of the board and then be fully able to use serial communications through RX(D0) and TX(D1) without having to set up a solution using firmware?

You’ll need to have UART communication implemented in firmware, but you won’t need to implement a USB device.
If you feel a post has answered your question, please click "Accept as Solution".
Saint32
Associate II

>You’ll need to have UART communication implemented in firmware

Would this be a complicated task? What steps would be required to do this?

I had planned to program the Nucleo using the Arduino IDE. Will implementing UART communication in firmware create a conflict with using the Arduino IDE?