Production: firmware loading and testing questions


For prototyping, I been loading the firmware OTA but in production this will be a problem. In my current design, I am using the jtag pins for five buttons (D3-D7 on the P1 module) also expose jtag pin on pads. I also expose the USB pads but I am using the TX pin as a pwm so no serial. Hope I can do without the TX pin for production.

Could the jtag pins function as GPIO and jtag for programming the firmware? Is there a guide to program the firmware using jtag?

I am trying to plan out how to take the current prototype to production testing to production. Any idea would be great.

Thank you for the help.

You can program via USB, JTAG, OTA and once you put your device into Safe Mode (or deactivate your PWM and then call Serial1.begin()) you will regain access to Serial1.

So I’m not quite sure what your actual problem is.

What ScruffR said. And also, as long as you expose D6 and D7 you can use SWD to program both user and system firmware. If you use a software-controlled internal pull-up or pull-down for your buttons on D6 and D7 you should be able to use the pins for both SWD/JTAG and buttons.

@ScruffR and @rickkas7 Thanks for the reply. I guess my problem is that I have not use either jtag, or USB to program the firmware before. So I want to make sure I know how and can do it with my current design in production to cover all the bases.

@rickkas7, I am currently using external pull up for the buttons. Would this cause a problem to set the pins in SWD/JTAG mode? Or as @ScruffR said as long as I can put the device into Safe Mode I can use USB or Jtag to program the device?

As long as I can used the pins as button and jtag than I am good to go. :smile:

When I wrote that I figured a pull-up would probably work but I hadn’t tested it. I just tested with 10K pull-ups on D6 and D7 and it worked fine.

SWD puts a weak (40K) pull-up on D7 which is used as an input and output (SWDIO). The SWCLK pin on D6 is a push-pull, so that doesn’t matter.

With a pull-up everything works fine, but if you had a stronger pull-down on D7 it would likely cause problems.

Also, make sure you have a way to stop your firmware from running, like by entering DFU mode. I like to put D6, D7, TX, RX, and GND on an easily accessible set of pads or a header for easier debugging later on. If you don’t have physical buttons for RESET and SETUP, add those lines to the header as well.

@rickkas7 Thank you for the information. :slight_smile: