PSoC™ 4 Forum Discussions
text.format{('custom.tabs.no.results')}
(this post is a copy of one I posted in the "PSoC Creator Software" section of this forum, code and packets at the end)
Hello,
I'm writing an Bootloader Host (that is, which sends a new Bootloadable to the PSoC bootloader via an UART link), running on another STM32 chip. I can't use the AN68272.zip code due to major architecture differences, so I wrote my own.
I can send most packets without any sort of issue, in that order :
- Enter Bootloader (0x38)
- Verify Application Checksum (0x31)
- Flash Array ID (0x32, two times, for both flash chips)
- Send Data (0x37). That's where the problem arises, as I can only send one byte of data at a time. More than one byte of data (size in packet > 1), and the Bootloader answers with a BOOTLOADER_ERR_LENGTH (0x03) error. I'm pretty sure the packet is well formed, that the checksum is valid, and that everything is in place.
"Flash Array ID" packet also contains more than one byte, and the Bootloader accepts it without issue.
"Program Row" (0x39) exposes the exact same problem. No matter what I do, it'll answer a 0x03 error.
I've tracked down the error in the Bootloader at the test if (((pktSize + Bootloader_1_MIN_PKT_SIZE) > numberRead)) in Bootloader_1.c around line 1744.
If someone could point me to the obvious mistake I'm making, I'd be very thankful.
Thanks a lot !
Here is the full code of my packet generator :
// Sends a command to the bootloader containing a command ID and optionnal data
uint8_t send_bootloader_packet(uint8_t cmd, uint8_t *data, uint16_t size) {
uint8_t packet[140]; // FIXME
uint16_t crc = 0x00;
packet[0] = 0x01; // Start byte
packet[1] = cmd; // Command ID
packet[2] = (uint8_t) (size&0xFF); // data length, LSB
packet[3] = (uint8_t) (size>>8); // data length, MSB
if(size && data) memcpy(&packet[4], data, size); // Copy data
crc = bl_basic_summation(packet, size+4); // Compute CRC on the first 4 bytes and the data
packet[size+4] = (uint8_t) (crc&0xFF); // CRC LSB
packet[size+5] = (uint8_t) (crc>>8); // CRC MSB
packet[size+6] = 0x17; // End byte
return send_UART(packet, size+7);
}
Packets sent and received :
Get Flash Size for array 1, works flawlessly
>>> 01 32 01 00 01 CB FF 17 // Packet 0x32, 1 byte of data, summation checksum
<<< 01 00 04 00 00 00 FF 01 FB FE 17 // Valid answer, usable flash in range 0000-01FF
Send Data,doesn't work
>>> 01 37 08 00 00 40 00 20 91 24 00 00 AB FE 17 // Packet 0x37, 8 bytes of data, summation checksum
<<< 01 03 00 00 FC FF 17 // Answer, error 0x03
I'm having a problem receiving 8-bit byte data using a SCB 3.0 configured as a UART. I can transmit full 8-bit byte data without issue (0x00 - 0xFF). When receiving any byte greater than 0x7F, 0x3F is returned.
I'm not sure if the problem is a hardware issue, or a problem with the code that maintains RX FIFO and the RX software buffer. I have not modified any of the SCB code that is generated by Creator 3.3
I have verified that the incorrect value is being saved to the RX software buffer. SCB_UartGetByte(), SCB_UartGetChar(), and SCB_SpiUartReadRxData all return the same incorrect value.
Configuration:
CY8CKIT-043 PSoC 4200M
SCB 3.0 - UART
Mode: Standard
Direction: TX + RX
Baud rate: 115200
Data Bits: 8 bits
Parity: None
Stop Bits: 1
Oversampling: 16
RX Buffer size: 64
TX Buffer size: 64
Interrupt: Internal
I'm new to PSoC and Creator, but I have worked with serial ports in embedded systems for years and haven't come across a problem like this before. Has anybody in the PSoC community seen this problem or have any suggestions?
Thanks,
Gary Beam
Hi everyone,
I would like to ask for some hints to prevent the PSoC 042 BLE from not been detected. In my case I am coding a java application on Windows 10 and I can see any other bluetooth devices except the psoc ble.
Show LessWindows 10 does not appear to recognize the BLE Dongle. Any ideas?
Page 94 of the TRM (section15.2.2 and figure 15-1 specifically) shows that the SCB MISO line is tri-stated when the SCB is not selected by the SPI master. This is excellent news for me, but I don't see anywhere in that section where it is explicitly stated that the SCB tri-states the MISO line when the SCB is not selected.
Has anyone used the SCB where tri-stating the MISO line was a requirement in the design? I see a reference to SID172 and Thso in the AC characteristics but no timing diagram to give me the warm fuzzy feeling that these AC characteristics refer to what I think they refer to (how long it takes the SPI slave peripheral to tri-state MISO when the device is no longer selected).
Show LessI am working on a project that requires BLE communication between PSoC and an android application. But I am facing problem with connecting it to the application. The application I am using is "BT voice controller" downloaded from play store. Can I know if PSoC is compatible with apps other that cysmart or if yes how to configure it accordingly? Thanks in advance 🙂
Show LessI have written a small amount of code, that I put in a "generated_source" file.
Of course, each time I regenerate, it overwrites my "custom" code.
is there somehow I can delimit this code so it's retained in the "generated_source" file??
I thought there was, but not having luck searching for it on Cypress site!
Thanks
Show LessHi to all,
I am using a CY8CKIT-042-BLE kit to do my broadcaster device. I have based my firmware on the Cypress example "Dynamic Broadcaster" (example 9) and all is running fine if I check the BLE transmissions through the dongle and CySmart. The problem is that I have realized that I can't see my BLE device on any smartphone both with iOS, Android (4.2 and 5.1) or Windows Phone 8.1.
As I thought the problem was on my code, I have tested directly the Cypress examples 8 ("Constant broadcaster") and 9 ("Dynamic Broadcaster") but the results are the same: I find the BLE device on CySmart but it doesn't happens if I search with an smartphone or even with a laptop with BLE.
I have modified the advertising intervals to see if there are some improvement, but I didn't saw any upgrade.
Could someone help me?
If more information is needed, feel free to ask for it.
In advance, thank you for your time.
Josué
Show LessHi have a 32 bit basic counter I am trying to read it by a status register in PSoc 4, but I have only 8 bit register.
Can you help me with this?
Show Less