- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I'm trying to write some data into a user row, but the PSOC4 device just freezes at that function that writes to the user-row. The debugger just stops at the function call, and you cannot put breakpoints inside the function. The IMO is enabled and at 48 MHz as well.
Any other ideas why this function won't work?
void controller_testfun(uint8_t* data, uint8_t num_data) {
uint32_t code;
uint32_t row = 0;
uint8_t write_data[CY_SFLASH_SIZEOF_USERROW];
// Fill the full row
memcpy(&write_data[0], data, num_data*sizeof(uint8_t));
for (uint8_t loop1 = num_data; loop1 < CY_SFLASH_SIZEOF_USERROW; loop1++) {
write_data[loop1] = 0;
}
code = CySysSFlashWriteUserRow(row, write_data);
if (code != CY_SYS_SFLASH_SUCCESS) {
code = CySysSFlashWriteUserRow(row, write_data);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay, so I've been debugging for awhile now, but the minute I posted to the forums, I figured it out!
CY_SFLASH_SIZEOF_USERROW is actually 256 bytes for my device, so using the uint8_t for the loop variable and size leads to the infinite loop!
void controller_testfun(uint8_t* data, uint16_t num_data) {
uint32_t code;
uint32_t row = 0;
uint8_t write_data[CY_SFLASH_SIZEOF_USERROW];
// Fill the full row
memcpy(&write_data[0], data, num_data*sizeof(uint8_t));
for (uint16_t loop1 = num_data; loop1 < CY_SFLASH_SIZEOF_USERROW; loop1++) {
write_data[loop1] = 0;
}
code = CySysSFlashWriteUserRow(row, write_data);
if (code != CY_SYS_SFLASH_SUCCESS) {
code = CySysSFlashWriteUserRow(row, write_data);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay, so I've been debugging for awhile now, but the minute I posted to the forums, I figured it out!
CY_SFLASH_SIZEOF_USERROW is actually 256 bytes for my device, so using the uint8_t for the loop variable and size leads to the infinite loop!
void controller_testfun(uint8_t* data, uint16_t num_data) {
uint32_t code;
uint32_t row = 0;
uint8_t write_data[CY_SFLASH_SIZEOF_USERROW];
// Fill the full row
memcpy(&write_data[0], data, num_data*sizeof(uint8_t));
for (uint16_t loop1 = num_data; loop1 < CY_SFLASH_SIZEOF_USERROW; loop1++) {
write_data[loop1] = 0;
}
code = CySysSFlashWriteUserRow(row, write_data);
if (code != CY_SYS_SFLASH_SUCCESS) {
code = CySysSFlashWriteUserRow(row, write_data);
}
}