Today we solved our Zigbee problem, it was really silly: we were not waiting enough time before and after entering the Zigbee’s command mode. We had a loop to do this waiting that worked fine, but since we programmed the System Boot with a clock twice as fast as before, the loop was not long enough anymore.
Since we had both motors and zigbee working well, Helen wrote a basic program to control the motors with the keyboard, sending directions through Zigbee.
Gabriel is working on driving our OLED screen. He wrote a program following the example in the datasheet but it did not work. It is difficult to debug because the bug can be either in software or in the pin assignment done in the Libero project (FPGA). We will re-check the pin assignment tomorrow. He also started working on a way to make it simpler to write the .dat file (the image to program the FPGA and the System Boot).
I wrote some code to use the encoders, and set the Libero project to set flags for the corresponding ADCs, so an interrupt would be generated when the measure in the ADC overcomes a certain threshold. For some reason I have not figured out yet, the interrupt routine is never called. For now I will leave the interrupt approach, and create a FreeRTOS task to monitor the ADC samples.
After preparing the patch to OpenOCD to support writing in the flash memory, we sent the patch. It was refused due the amount of code from Actel we used to generate the embedded bin program. We could provide a cleaner code, removing the unused things from Actel’s driver, but it is working and we don’t have much time, after Rose we can work more in the patch.
If you are still interested in this patch you can found it here. Or send us an email .
Our PCB has arrived! \o/ Seems that we are going to weld the components tomorrow
Libero (FPGA and project configuration)
The routing of FPGA is done, a map between MSS ans FPGA, which are the things that can be connected directly with a GPIO and which can not. So after we have our robot, we will be able to drive the peripherals which doesn’t need a complex FPGA support.
Necessary HDL modules will be done together with the peripheral’s drive.
We integrated FreeRTOS to our project. There is just some minor things we need to configure, as the code work in the Ram but doesn’t in Rom memory =/
SPI Flash Memory
SPI driver is done and tested for SmartFusion Evaluation Board, we will need to adjust some aspects of the drive to our SPI flash memory
After the OpenoCD patch, we tested DirectC in flash it is working but it is not fully integrated with the project. Tomorrow we hope to have the FPGA programing environment working and tested with our Robot.
This weekend me and Helen worked more on the OpenOCD’s patch to write in the SmartFusion eNVM flash. We finally got it working, now we can load and execute code in flash \o/. Helen is now making some adjustments and organizing the git tree so we can commit it to OpenOCD.
We used Actel’s eNVM driver to create a stub that OpenOCD places in RAM and uses to perform the writing. The stub is compiled, the elf is converted into a binary image which is converted to a char array that is included in the OpenOCD source. After that, we wrote a OpenOCD flash driver for SmartFusion. A OpenOCD flash driver demands certain functions to be implemented, but as we’re in quite a hurry, we minimally implemented only the ones we needed: probe and write. The probe function initializes information that OpenOCD has on the flash bank. We saw in other drivers that it usually does more things, but we implemented only the basic to allow the write function to work. The write function places the stub in RAM, then repeatedly places a part of the image in RAM and runs the stub to write them to flash.
I’ll now move to creating the Libero project for our robot. Libero is the Actel’s development plataform for SmartFusion, and we need to use it to redirect the GPIOs to the FPGA pads. For now, it will generate a FPGA image that contains only this routing of GPIO to pads. Latter, as we work on the app libraries, we will insert the modules to control the motors, LCD, and other peripherals. Then we will use it to generate the final FPGA image that we will load into the Tutobot.
Saturday our PCB was completed, some screen shots :
Gabriel is working in the DirectC, a set of code to implement In-application programming (IAP) for the Cortex and FPGA. The main goal is to program the FPGA from an image.dat file generated by Libero IDE as we won’t be using a FlashPro chip and we are not sure if the FlashPro software can be used without it.
We also studied how to work with Libero, route pins of FPGA and generate an image.dat file. The program is not complicated and the Libero Project of Tutobot should be ready soon.
Now Thalita and I, we are working in a patch to OpenOCD to be able to write in the flash memory of SmartFusion by OpenOCD. The idea is loading a code in RAM which writes on the Flash as we didn’t find any documentation about driving the Flash memory directly through JTAG.