PSoC™ 5, 3 & 1 Forum Discussions
USB bootloader works the first time, but on subsequent tries I get this error message: The application is currently marked as active and cannot be modified.
Show LessHi,
I can program a hex file with a MiniProg3 and its GUI application as attached picture shows.
Then I followed the sample code in "C:\Program Files (x86)\Cypress\Programmer\Examples\Programming\PSoC3_5\SWD\C_Sharp", if I run this sample code directly without any changes, the prompt tells me:
"Failed! PSoC device is not acquired! Check connection of the chip to the programmer"
So I change the code with the settings on the GUI application, Below is the code of setting part in ProgramAll() function:
Mainly I have many issues on:
1. The prompt tells me "Failed! Device is not in ISSP mode"
2. CheckHexAndDeviceCompatibility() function could not pass.
3. EraseAll() function is unable to run.
4. Sometime I change the "Power" mode to "Power Cycle", sometimes I change the function from xxx() to PsoC3_xxx() if I found there is one, but it still could not work. Anyone know what's wrong there? Thanks!
Code:
if (pp == null) return -1;
string filePath = "E:/Projects/X2/CRTS-XRAY-XPS-Bootloader-v3.2.hex";
int hr;
//Port Initialization
//Setup Power - "5.0V" and internal
hr = pp.SetPowerVoltage("0.5", out m_sLastError);
if (!SUCCEEDED(hr)) return hr;
hr = pp.PowerOn(out m_sLastError);
if (!SUCCEEDED(hr)) return hr;
//Set protocol, connector and frequency
hr = pp.SetProtocol(enumInterfaces.SWD, out m_sLastError); //SWD-protocol
if (!SUCCEEDED(hr)) return hr;
hr = pp.SetProtocolConnector(0, out m_sLastError); //5-pin connector
if (!SUCCEEDED(hr)) return hr;
hr = pp.PSoC3_SetProtocolClock(enumFrequencies.FREQ_01_6, out m_sLastError); //3.0 MHz clock on SWD bus
// Set Hex File
int hexImageSize;
hr = pp.HEX_ReadFile(filePath, out hexImageSize, out m_sLastError);
if (!SUCCEEDED(hr)) return hr;
//Set Acquire Mode
pp.SetAcquireMode("Power", out m_sLastError);
//The "Programming Flow" proper
//Acquire Device
//hr = pp.DAP_Acquire(out m_sLastError);
hr = pp.DAP_Acquire(out m_sLastError);
if (!SUCCEEDED(hr)) return hr;
//Check Hex File and Device compatibility
//bool fCompatibility;
//hr = CheckHexAndDeviceCompatibility(out fCompatibility);
//if (!SUCCEEDED(hr)) return hr;
//if (!fCompatibility)
//{
// m_sLastError = "The Hex file does not match the acquired device, please connect the appropriate device";
// return -1;
//}
//Erase All
hr = pp.EraseAll(out m_sLastError);
if (!SUCCEEDED(hr)) return hr;
Show LessDear All:
I am working in a design having a SAR ADC and AMUX. Check the picture attached for the schematic.
ADC is single ended, internal VREF 1.024, Bypassed, range 0-2.048V.
I have three small questions regarding this subsystem:
(1) To calculate ADC offset I have connected the last channel of the AMUX (COL_9) to VSSA (externally, on the PCB) and use the following code
AMux_FastSelect(9);
CyDelayUs(10);
ADC_SAR_StartConvert();
ADC_SAR_IsEndConversion(ADC_SAR_WAIT_FOR_RESULT);
adcReading = ADC_SAR_GetResult16();
ADC_SAR_SetOffset(adcReading);
Do you think is this correct?
(2) Should I do anything similar to calculate the ADC_SetScaledGain()? In the ADC datasheet, it says:
"It should only be used to further calibrate the ADC with a known input or if the ADC is using an external reference."
In case yes, What do suggest me?
(3) On the AMUX datasheet, AMUX_FastSelect command seems to take 4 us to set the new channel (Table 1, pag8) for a 48Mhz Clock, so, as I am using a 24Mhz clock, I have added a CyDelayUS(10) on the code above. Is this correct? More or less time?
Thanks in advance,
Joaquin.
Show LessHi, I'm a bit new to USB device design and have a fairly straight forward question about connection state.
My application is a keyboard style piece of hardware that has custom buttons, USBFS with three HID end points for keys, mouse and volume control. It's always powered and always connected to an Embedded X86, running Windows 10 or similar. The OS will reboot many times during the users day, because Windows is like that, and each time, my device will stop working, requiring a full power cycle to bring us back.
I need to detect the USB disconnection by host... right now I'm using USBFS_1_bGetConfiguration, and clearly it is returning a != 0 value even after the OS has shut down.
Should I be using isConfigurationChanged()? This would let me see the OS come up, then I'd reInit the USBFS, use USBFS_1_bGetConfiguration to confirm a connection and load each end point? I'm working on this now with no success yet.
Thanks, Brent.
Show LessHi all,
I am going nuts with MDB serial communication, sending MARK/SPACE data. CPU clock is se to 24Mhz.
I have an UART block, set to 9600 and no hw flow. 1 bit parity. I use the block only for sending. The problem that i'm facing that MARK is set on wrong characters which i trace on the line. If i CyDelay(100) it always works, but the problem arises when I want to sent characters in sequence:
For example following code:
UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_MARK);
UART_MDB_SLAVE_TX_PutChar((uint8) 0x01); //
UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_SPACE);
UART_MDB_SLAVE_TX_PutChar((uint8) 0x02); //
UART_MDB_SLAVE_TX_PutChar((uint8) 0x03); //
UART_MDB_SLAVE_TX_PutChar((uint8) 0x04); //
Puts mark on byte 0x03 ?! or sometimes 0x02...
If i send 5 bytes
UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_MARK);
UART_MDB_SLAVE_TX_PutChar((uint8) 0x01); //
UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_SPACE);
UART_MDB_SLAVE_TX_PutChar((uint8) 0x02); //
UART_MDB_SLAVE_TX_PutChar((uint8) 0x03); //
UART_MDB_SLAVE_TX_PutChar((uint8) 0x04); //
UART_MDB_SLAVE_TX_PutChar((uint8) 0x04); //
Puts mark correctly on 0x01
So am i getting this wrong somehow ? To me it looks random, if i send in a while loop:
while(1)
{
UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_MARK);
UART_MDB_SLAVE_TX_PutChar((uint8) 0x01); //
UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_SPACE);
}
Mark is set ever 5 - 10th byte ?!
What am i missing ?
Please some help
Show LessThe debug mode does not show the variables. I don't know if I did something wrong or there is like a bug that was present in Psoc 4.0.
The variables are not present in the debug mode.
Show LessI had initially posted requesting for info on MultiApp bootloader, but the post wasn't successful.
Is there any documentation on how to use MultiApp bootloader which can be of use..
Show LessI have a workspace with three projects:
1. Bootloader
2. Bootloader and Bootloadble "Image1"
3. Bootloader and Bootloadable " Image2"
I can attach to running target for Image1 and the debugger (after reset) will stop at line 1.
But
for Image 2 I get the following error in the output window
The target program has stopped at: file: line: -1 function: ?? address: 0x00021CDC
Applying reset always ends up at ine -1.
Disasembly windows shows I am looking at the right image.
Single step or Go, doesn't do anything
Any insight is greatly appreciated.
Giri
Show Less