Other Parts Discussed in Thread: CC1310
Hi,
I have been trying to fix a bug in the radio we developed around CC1310. The problem is boiled down to a simple test setup:
STM32F091RC <==> CC1310
Another MCU, STM32F091RC is connected to two pins on CC1310(IO2 as UART RX, IO3 as UART TX) plus shared GND. CC1310 is flashed with UART echo example from API documentation, also attached below.
STM32F091RC sends some dummy bytes to CC1310 periodically and expects CC1310 sends back whatever are sent to it. If new firmware is flash into STM32F091RC, I will have to reset CC1310 to get uart echo to work. In our customized board, I also observed that after a cold start during which both STM32F091RC and CC1310 get power from the same 3.3V rail at the same time, I also have to reset CC1310 to get uart echo to work. Meanwhile, in our customized PCB, data sent from CC1310 to external host MCU will continue to work even after host MCU is reset. So the problem is just somehow CC1310 cannot receive data from external host MCU if host MCU is reset.
On the other hand, if I just keep CC1310 connected to debug tool on launchpad, send dummy bytes from computer, I always see echo after I reset launchpad. I don't remember we had such problem when the external MCU is one from MSP430 family.
So the problem seems like a compatibility issue. Is there anything else except resetting CC1310 to make sure UART communication between CC1310 and other MCUs such as those from ST to work?
Thanks.
#define MAX_NUM_RX_BYTES 1000 // Maximum RX bytes to receive in one go #define MAX_NUM_TX_BYTES 1000 // Maximum TX bytes to send in one go uint32_t wantedRxBytes; // Number of bytes received so far uint8_t rxBuf[MAX_NUM_RX_BYTES]; // Receive buffer uint8_t txBuf[MAX_NUM_TX_BYTES]; // Transmit buffer // Read callback function static void readCallback(UART_Handle handle, void *rxBuf, size_t size) { // Make sure we received all expected bytes if (size == wantedRxBytes) { // Copy bytes from RX buffer to TX buffer size_t i = 0; for(i = 0; i < size; i++) txBuf[i] = ((uint8_t*)rxBuf)[i]; // Echo the bytes received back to transmitter UART_write(handle, txBuf, size); // Start another read, with size the same as it was during first call to // UART_read() UART_read(handle, rxBuf, wantedRxBytes); } else { // Handle error or call to UART_readCancel() } } // Write callback function static void writeCallback(UART_Handle handle, void *rxBuf, size_t size) { // Do nothing } void *mainThread(void *arg0) { UART_Handle handle; UART_Params params; // Init UART UART_init(); // Specify non-default parameters UART_Params_init(¶ms); params.baudRate = 115200; params.writeMode = UART_MODE_CALLBACK; params.writeDataMode = UART_DATA_BINARY; params.writeCallback = writeCallback; params.readMode = UART_MODE_CALLBACK; params.readDataMode = UART_DATA_BINARY; params.readCallback = readCallback; // Open the UART and initiate the first read handle = UART_open(Board_UART0, ¶ms); //UART_control(handle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL); wantedRxBytes = 1; int rxBytes = UART_read(handle, rxBuf, wantedRxBytes); while(true); // Wait forever }