Hi everyone,
I didn't find many postings on modifying the mindtree example projects for use with the PAN1315ETU board. First I'd like to mention a few items that tripped me up to help others if they encounter them. All notes and questions below are in reference to modifying the accelerometer project. I've highlighted my questions in bold for the skimmers out there. Just to be clear, I did get the sample projects working and a reasonably complex mod working, so I believe my setup is sound (or perhaps almost sound :-) ).
1. Adding new FreeRTOS tasks
The documentation claims that you should add entries for your additional tasks to bt_os_thread_property and the order of task creation has to match the entries. The suggestion is also to increase the size of OS_MAX_HEAP_MEMORY as you add tasks. I eventually did get my own tasks running, and here is what I encountered.
a. I didn't know exactly when the library tasks were created in relation to my new tasks. I modified main.c and did a xTaskCreate before even the first function call (sdk_bsp_init). I found that I had to add my tasks to the end of the array in the order that they were created in relation to each other. In other words, after the USER_TASK_NAME, WRITE_TASK_NAME, and READ_TASK_NAME entries came my entries.
b. The big gotcha was that the FreeRTOS rules still apply. configTOTAL_HEAP_SIZE needed to be increased also. Since this wasn't mentioned in the documentation, I assumed that there would have been an equation to handle this (configTOTAL_HEAP_SIZE = BASE_SIZE + OS_MAX_HEAP_MEMORY), but this doesn't appear to be the case.
My memory is a little fuzzy on this, but I believe the failure mechanism (at times, depending on memory usage) was that the "bluetooth on" function would go off in the weeds. It wouldn't necessarily do a return from main in all cases (typical FreeRTOS failure mechanism for not being able to create all the tasks is the scheduler call will return). The xCreateTask functions returned values never triggered the assertions I had in place either. In the end, I did get this working so I suspect the method mentioned is sound. Does this sound correct to anyone else who's managed to add tasks to the sample project?
Now the questions portion ...
2. On the PAN1315 module, it seems that the silk-screened pads on top do not connect directly to the ports named at the RF1/2 connectors (buzzing them out with a meter). I soldered directly to the pads next to the RF headers to work around this. I searched around a lot and could not find schematics for this board. Does anyone know where to find them? It appears to be a 2-layer board, so I can trace most of the routes visually except I don't know what components IC2, IC3, and IC4 are. If no one has schems, perhaps at least some hints on the pin-outs for IC2, IC3, and IC4?
3. Changing ports (say from UCA2 in this example project to UCA1) doesn't seem as easy as changing sdk_config.h. I commented out all USB, accelerometer, and ADC code in this sample project (right now, I'd just like to see it pair using a different port). I'm trying to use P2.4=CTS, P2.5 = RTS so I removed the rocker switch and soldered wires directly. I removed S1 as I'm using P2.6 for SLOW_CLK and soldered directly there also. I wire wrapped RX/TX to JP5 with the jumpers removed (actually all non-power physical jumpers are removed). I am not plugged into the RF headers now but left my wire-wrap jumpers attached on RF3 (believe they shouldn't hurt anything). I've tied grounds and powers together and am using an external supply hooked to the battery clips with switch set to battery mode. I've wire wrapped BT_NSHUTD to pin 9 of RF3 (P8.2). I did get the RTS/CTS bit incorrect the first time around (believe this hung at a UART_TX macro as opposed to entering the idle task, if memory serves me correctly ... the voltage went to mid-rail which was the give-away). I suspect the issue may be with sdk_bt_port_config as there seem to be ports that are hard-coded for the required RF3 jumper mods. Can someone explain the details on why the RF3 jumper mods are required and how the sdk_bt_port_config function as well as the libraries we don't have source to are related to these mods?
I realize there is a lot of information here, but I'm a bit stumped at the moment and wanted to give useful background. Any help you can offer is greatly appreciated....
Thanks
-Freddy