Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusing SWD_DIO and SWD_DIO #5

Open
RGassmann opened this issue Dec 6, 2017 · 2 comments
Open

Reusing SWD_DIO and SWD_DIO #5

RGassmann opened this issue Dec 6, 2017 · 2 comments

Comments

@RGassmann
Copy link

Hi Peter,

finally the time has come that I was running out of GPIO-Pins on one of MKL17z256VFM4 Projects.
So after a careful check of every I/O I realized that I could use the SWD_DIO and SWD_SCK to drive my status Led's. As that would be sufficient for my project I checked the USBDM-Schematics (FRDM-Board I am using the OpenSDAv2_0_Unique_ID.bin Verison 4.12.1) and thought that it should work fine.
To be 100% sure I made a little test HW where I connected two LED's (with a 1k resistor) to the DIO and SCK Inputs and wrote a little program that toggles those LED's. Now of corse programming it worked the first time. Unfortunately after that the programming did not work anymore. So I experimented a little an found the following:

  1. A further programming of the device is possible if first a "Detect Chip" is issued. (Since after that the MCU is in some sort of Reset-State)

  2. I noted that the DIO-LED flashes oddly for a very short time when I execute the following sequence "UsbdmFlashProgrammer -target:arm -device:MKL17Z256M4 -erase:Mass -program image.srec -execute" without calling "Detect Chip" first.
    2.1. As the MCU at that time didn't stop working I had the feeling that the MCU was never in reset mode. So I short-circuited the RST-Signal with GND and Run the sequence again. As soon as the DIO-LED started to flash I let the RST-Signal lose. This time the programming was successful. That meant that I had to investigate further. Now as I attached the Oscilloscope I expected to see the following signals:
    First RST from high to low after some time Data on SWD_DIO and SWD_SCK,
    but what I found was that the RST signal wasn't pulled low ever. So I reprogrammed my device back to the point where DIO and SCK are not configured as OUTPUTs and run a second programming with an attached oscilloscope.
    The result astonished me even more as at first some Data on SWD_DIO and SWD_SCK is sent followed by a RST-low signal.
    This leaves me with the following questions:

  3. Why is there a data transfer before the RST-Signal is pulled low.

  4. What exactly happens during time right before the RST-Signal is pulled low?

  5. Why isn't this problem not present in the "Detect Chip"-procedure. Whats the difference.

  6. Do I have a chance to use the DIO ans SCK pins for other purposes other than programming?

Can you please enlighten me.
Thanks for your help,
Roman

@podonoghue
Copy link
Owner

podonoghue commented Dec 8, 2017 via email

@RGassmann
Copy link
Author

Hi Peter,
first of all thanks for your fast answer. After your info, that you have changed the reset part, to also support LPC-Devices, I tried the current release.
While I had no problem programming my device with the sequence of my last post, I ran into several problems with the GUI-Programming.

  1. "Detect Chip" will report "Execution of TCL script returned an error" every first time. Independent of the Reset Method. After the first run the device is in reset and thus a secound run of "Detect Chip" works.

  2. "Program Flash" fails with report " BDM has no connection to target". Also independent of the Reset Method. The only way to programm a device is by running "Detect Chip" first.

Is it possible that the command sequence and the GUI-Programming dont use the same code sequence?

Unfortunately I didn't had time to examine this further. I hope I'll find some time during the next few days or at least during the X-Mas days.
I'll come back to you as soon as I'll have more infos.

Thanks,

Roman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants