Other Parts Discussed in Thread: CC2538
Hi guys!
I've been trying to integrate the stock no-RTOS "UART emulation" code generated with the Sensor Controller Studio with a Contiki-based project.
*.- My first try with stock Contiki power control ends up in a reboot loop almost as soon as my SC code is executed.
*.- I then added a LPM_MODULE(softuart_module, NULL, NULL, NULL, LPM_DOMAIN_PERIPH); and a lpm_register_module(&softuart_module); on my init code and then at least the MCU doesn't reboot, and I'm able to get a couple of characters out of the SC-based UART, but only two or three chars get transmitted OK, with every char increasing the possibility of corruption.
*.- I then disabled RF to see if there's something in the RF/comm code that might be interfering.... but no changes...
*.- I then tested a more radical idea, did some changes on Contiki's LPM code (cpu/cc26xx-cc13xx/lpm.h / .c) to disable everything like its done on the cc2538 with the LPM_CONF_ENABLE definition. Results: With LPM disabled, now I get 6-10 characters OK on the SC-UART. There's some progress ....
*.- I then tried disabling interrupts: No changes at all.
*.- Next tried disabling the RX/alert callback code to see if it helps: It doesn't.
Now I ran out of ideas to test what could be interfering with the TX of my messages.
Any ideas?
The current test code is something like this:
LPM_MODULE(softuart_module, NULL, NULL, NULL, LPM_DOMAIN_PERIPH);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(cc26xx_my_process, ev, data)
{
PROCESS_BEGIN();
// let's turn radio off to see if helps
NETSTACK_RDC.off(0);
printf("CC26XX test v26\n");
// to be used in the alert callback for RX
softuart_event = process_alloc_event();
// doesn't do anything since I killed the LPM at contiki's code level
lpm_register_module(&softuart_module);
// AUX domain access
scifOsalEnableAuxDomainAccess();
// my alert callback
scifOsalRegisterTaskAlertCallback(&uartAlertCallback);
scifInit(&scifDriverSetup);
// Start the UART emulator
scifExecuteTasksOnceNbl(BV(SCIF_UART_EMULATOR_TASK_ID));
// Enable baud rate generation
scifUartSetBaudRate(9600);
// Enable RX (10 idle bit periods required before enabling start bit detection)
scifUartSetRxFifoThr(SCIF_UART_RX_FIFO_MAX_COUNT / 2);
scifUartSetRxTimeout(10 * 2);
scifUartSetRxEnableReqIdleCount(10 * 2);
scifUartRxEnable(1);
// Enable events (half full RX FIFO or 10 bit period timeout
scifUartSetEventMask(BV_SCIF_UART_ALERT_RX_FIFO_ABOVE_THR | BV_SCIF_UART_ALERT_RX_BYTE_TIMEOUT);
scifUartTxPutChars("Hello how's everything?\r\n",25);
TIA!