Trying to flash a K64F, CPU Could Not Be Halted - c

I am trying to program a Cortex M4 that was placed on a custom board. The processor is the MK64FN1M0VLL12. I wrote the code using the FRDM-K64F dev board, which uses OpenSDA to load the bin via USB. The code was written in mbed, which as far as I know doesn’t have any support for loading the program to the processor. For the production board, I was planning on loading the program via a J-Link programmer, since I didn’t include the OpenSDA interface.
Using the J-Link Commander tool, I’ve found that I have to hold the reset button down on the board in order to get any sort of response. When I don’t hold down reset, I get the follow:
When I do hold down reset, I get:
When I try to load the bin, I get messages about the CPU not halting. I get this whether I’m still holding down reset or not:
The O.K. message is a little misleading. I tried uploading a program with just a blinking LED, but the LED isn’t blinking.
I’m not sure where to go from here. Several days of Googling hasn’t led me anywhere fruitful.

Related

MPLAB gives Low power and device failed to connect error when programming pic18f25q10

I am trying to add a simple led application to a PIC18F25Q10 in another circuit using the Curiosity HPC development board. I am using the MCLR, PGD, PGC and GND pins. Although I set the LVP mode to enable in the CONFIG settings and the program speed to low in the project properties, MPLAB " MPLAB has detected that the undervoltage configuration bit on the device is off and you have selected" error output . I also cannot connect to the PIC.
My MPLAB version is 6.5
I am using the X8 compiler (2.40).
I am throwing code with PKoB4.
I checked my circuit connections and confirmed that the MCLR, PGC and PGD pins were correct, but I kept getting errors.
I have done the steps to be applied here, but I have not reached a result. I cannot connect to the PIC.
Connecting to MPLAB PKoB4
Currently loaded versions:
Application version...........00.05.79
Boot version..................01.01.41
Script version................00.05.35
Script build number...........86fedc5c2e
Tool pack version ............1.8.869
Target voltage detected
MPLAB has detected that the low voltage configuration bit on the device is off and you have selected the low voltage programming option on the debug tool's property page. If you wish to use the low voltage programming option you must first do the following:
* Turn off the low voltage programming option on the debug tool's Program Options property page
* Program the low voltage configuration bit to on
* Turn on the low voltage programming option on the debug tool's Program Options property page
Connection Failed.
I checked the forum pages and updated MPLAB and the PKoB4 drivers to test the information that it might be version related, but I could not connect to the PIC.
I used another circuit because I thought there would be a problem with the PIC. I got the same error. I tried to load the code from another computer and I continued to get the same error.
I tried to code with ICD, it codes. However, I could not solve this error on the Curiosity HPC development board. I came across some information in the Curiostiy development board user's guide.
information Image..
I need to be able to connect to the PIC and throw code. I am curious about your thoughts and advice about my problem.
According to the advise of MPLAB your PIC chip has programmed to have LVP disabled. The curiosity boards has a built-in PICKIT which can program only in Low Voltage Programming mode. So you have to do the following steps:
Get a standalone PIC (i.e. PICKIT3) programmer
In config settings of your PIC set the LVP to be on
In MPLAB IDE, File > Project Properties > PICkit 3 > Program Options make sure that Use low voltage programming mode entry option is unchecked
Burn your PIC device with this configuration once using the standalone PICKIT programmer
These steps will prepare your PIC so that it can be programmed in curiosity board. Once you done with all steps correctly, you will be able to burn your programs using your curiosity.
When you program with the built-in programmers, you always wanna make sure that your PIC is programmed before with configuration LVP = ON. And also keep this config bit always ON as long as you keep programming it in a curiosity board.
One more thing to tell, MPLABX is automatically checks the Use low voltage programming mode entry option when you select the Connected Hardware Tool as your curiosity board.
Go ahead and try the steps and then let me know if I could help any further.

ARM Frequency control

I stumbled upon following problem:
I have a piece of software written in C++ and a device rk3399 (FriendlyELEC). The issue is performance of the code depends on whether or not display is attached to the device. If I ran my code via ssh (without display attached) I get 25% slower performance rather than if I ran code with display attached.
I figured it's a frequency scaling problem (device runs Lubuntu) I changed profile to performance (it was set to interactive initially), but that didn't help. I monitored voltage and cpu freq, all seems constant (1.2V, 1.12V) and (1.42 GHz, 1.8 GHz).
It's probably some control that tries to save battery and uses Display Port as decision flag. But I can't figure out what kind it is and where to find it.
Initially I was thinking I have problem with GCC flags (there could be some relevant info)
How to get the device to run with stable performance? What could be the problem?

Connection Failed Error with PicKit3 and MPlabX (IDE and IPE)

I'm trying to programm my PIC 16F628A with PICKIT3 in MPlabX, but I get the following error:
***************************************************** Connection Failed.
When I enable the "Power Target Circuit From Tool", I get another error:
The target circuit may require more power than the debug tool can provide. An external power supply might be necessary.
Connection Failed.
So a provided an external power supply of 5V and my PIC 16F628A is draining 10mA, despite nothing is connected, only the PICKIT3 to the MCLR, ICSPDATA and ICSPCLK pins of PIC.
I'm using Ubuntu 16.04, MPlabX IPE V4.05., and
PS: Yes, I know how to read a datasheet.
PS: Circuit and PICKIT3 works properlyt if I connect to PICKIT3 Programmer running on Windows 7.
The first issue can sometimes be resolved by shutting down MPLABX, disconnecting the PicKit from your computer and reconnecting everything. Seems the firmware and/or driver sometimes gets in a weird state and needs a good boot to get going again. I sometimes have to reboot my computer just to program my main board (Major PITA).
The second issue is not necessarily caused by an over current despite the message. I always got this error when my PicKit was plugged into an unpowered USB hub. It seems the lower USB bus voltage confuses the PicKit into thinking that the device is the cause for the voltage drop instead of the host simply not supplying the normal voltage. Try plugging it into a powered USB hub or directly into your computer.
I know this is an old topic but maybe this answer can help somebody else.
I use as well official PICKIT's as clones.
It could indeed be caused by a hardware issue.
E.g. short or already activated load like a bunch of LED's.
Disconnect all loads if possible.
When using an official PICKIT 3, this issue is often solved by setting the voltage your PICKIT should supply to a lower level e.g. 5 => 4.625.
In MPLAB go to the properties of your project.
Select PICKIT on the left.
Select Power from the selection dropdown at the top.
When you have a SURE electronics clone, this might do the trick. (Maybe this is also valid for other clones) The AMS1117 they used is the adjustable one.
They used a 680 and a 470 feedback resistor which gives a voltage of 3.09V ((680/470 +1))*1.25 + 50u * 680). If you swap the 680 Ohm resistor with a 750, the output will be closer to the probably desired 3.3V.
Source where I got the idea: https://jrainimo.com/build/2018/12/picfix/
Location FB resistor
Close MPlab, reconnect Pickkit, restart MPlab worked for me.
If you've just created a new project or created a new file, MPlab sometimes confuses some things.

Program Run fine in CY8CKIT-050 but fails in Hardware PSoC 5 FreeRTOS

PSoC Creator FreeRTOS PSoC 5 CY8C5868AXI-LP035 GLCD 128x64
Hi there,
I am facing weird problem with my Application on PSoC 5 based hardware. This application is based on FreeRTOS, and application contains 128×64 kind of monochromatic LCD (Graphical LCD), having controller like ks0107.
The problem is that if we run this program with the PIN used for CY8CKIT-050, it runs smoothly and complete every task as desired with no problem at all. But if we only change the MCU PINs as used in our Hardware and program the Hardware MCU with same program, application runs to certain point and then hang. We tried debug mode and found out that after running for some time application goes to :
CY_ISR(IntDefaultHandler)
{
while(1)
{
/***********************************************************************
* We must not get here. If we do, a serious problem occurs, so go
* into an infinite loop.
***********************************************************************/
}
}
which is in Cm3Start.c. And at this point application stays in hanged state.
Here please note that this only happens if we used the same program in our Hardware. But if we use it in Kit (CY8CKIT-050), it runs completely fine without any fault.
We would like to also share that we have used FreeRTOS prior to this application, and we have successfully built applications with FreeRTOS.
Attaching(as I don't know how to attach I am providing Google drive links):
Application program for CY8CKIT-050 here.
Application program for our Hardware here (Only with different PIN usage)
Call Stack window screen shot where problem occurs:
PS: This discussion is going on in parallel at
Cypress Community Forum
FreeRTOS Forum
Other Forum

Stop execution of previous code STM32F4Discovery

I have tried a simple Blinking LED program on my STM32F4 Discovery board by following this tutorial.
However, I am not sure how to stop this from running, i.e., when I unplug the device from the PC and plug it in, I would expect it to reset itself (I might be wrong too, please correct me if this is not the case).
The board keeps blinking the LED on connecting it again. How do I reset it to its original state? Pointers to references for embedded programming would also be helpful.
If "original state" means the program that was shipped with the board, then you can probably download that at ST's website. You'll need to program the chip's flash with that stock binary.
Note that by programming the board you're programming the flash memory which will retain its contents through power cycles.

Resources