Jump to content
jcR

Energia 0101E0013 - fram optimization and new SPI library not compatible with cc3000 launchpad

Recommended Posts

I tested the lauchpad FR5969 with the new version of energia.  After having changed both HIL.dll  and MSP430.dll  files in the directory 

E: \ ENERGIA_V13 \ energia-0101E0013 \ hardware \ tools \ msp430 \ mspdebug, I managed to correctly program the FR5969 launchpad. 

 

Searching the memory.x file in the E: \ ENERGIA_V13 \ energia-0101E0013 \ hardware \ tools \ msp430 \ msp430 \ lib \ ldscripts \ msp430fr5969, I saw that the compiler does not take advantage of the characteristics of FRAM which allows sharing of 64 kbytes memory between program space and ram space. 

Indeed it currently uses  the standard  2 kbytes static ram

I did some tests by changing the values ??to use 4 KB of RAM in fram memory and 44 kb to store the program and it seems to work ?. 

Question: Is this possibility can be integrated in a future revision of ENERGIA. 

 

Enclosed changes: 

old file memory.x

  ram (wx)         : ORIGIN = 0x1c00, LENGTH = 0x0800 /* END=0x2400, size 2K */ Static ram

  rom (rx)         : ORIGIN = 0x4400, LENGTH = 0xbb80 /* END=0xff80, size 48000 */

 

new file memory.x

 

  ram (wx)         : ORIGIN = 0xEF80, LENGTH = 0x1000 /* END=0xff80, size 4K */ Fram

  rom (rx)         : ORIGIN = 0x4400, LENGTH = 0xAB7F /* END=0xEF80, size 44000 */

 

 on the other hand i have tried  to use the new  ENERGIA version with the CC3000  TI BoosterPack . (it's work fine with VE0012)

I think it is impossible to use this booster pack with this release because simpelinkwifi library has been replaced by Wifi library and SPI library was modified and seems to be  incompatible with the old SPI library. 

Can I get a confirmation of my observations. 

 

Some assistance will be really helpful. Thanks in advance.

Share this post


Link to post
Share on other sites

The problem with what you're doing is now you have 2kB of RAM that will never be used. I'm assuming that by changing the RAM segment gcc will move your stack pointer aswell. I don't know if there is a good solution to this problem. The best way would be to define a different memory segment RAM_2 for example. then explicitly place some large arrays in there instead of RAM.

 

FRAM is great, but keep in mind you have a maximum clock rate of 8MHz. If your CPU is running at 16MHz it will be paused ~50%. (This gets complicated because there is a small cache that does a lookahead on FRAM reads, and if data is on the cache it will not be paused.)  If all your data is in FRAM then you might notice weird timing situations if you're trying to do something timing critical.

Share this post


Link to post
Share on other sites

Thankfully Energia only runs the FR5969 at 8MHz anyhow.  As for making this an "easy" feature, I'm not sure how @@energia feels about that since it'll be a complicated affair... requiring maintaining alternative copies of the toolchain's linker scripts/etc.  Perhaps in a future release this would be easier to pull off.

Share this post


Link to post
Share on other sites
I changed the size of the ram in order to compile the example:

File :  SimpleWebServerWIFI in  IDE Menu  File/Examples/WiFi

 

I Can not compile with Energia : 

Compiling error: 

Region 'ram' overflowed by 876 bytes. 

With the change I made the compilation is done without errors. 

Of course, the program does not work !! --> Following  the comments I made on the change of the SPI library in the 00013 release!!!!!

Can  the Energia  team  give me an answer please ?

I have posted the same request on Stellaristi blog without answers.

For me the problem with the new SPI driver concerns the following boards:  MSP430Fr5969,Lm4f120,Tiva Tm4c123 and TIVA Tm4c129

Share this post


Link to post
Share on other sites

 

I changed the size of the ram in order to compile the example:
File :  SimpleWebServerWIFI in  IDE Menu  File/Examples/WiFi
 
I Can not compile with Energia : 
Compiling error: 
Region 'ram' overflowed by 876 bytes. 
With the change I made the compilation is done without errors. 
Of course, the program does not work !! --> Following  the comments I made on the change of the SPI library in the 00013 release!!!!!
Can  the Energia  team  give me an answer please ?
I have posted the same request on Stellaristi blog without answers.
For me the problem with the new SPI driver concerns the following boards:  MSP430Fr5969,Lm4f120,Tiva Tm4c123 and TIVA Tm4c129

 

What has changed in the SPI library?  Do you have code specifics?

Share this post


Link to post
Share on other sites

The function SPIClass::transfer(uint8_t data) for V12 at line 245 SPI.cpp is 

{

unsigned long rxData;
ROM_SSIDataPut(SSIBASE, data);
while(ROM_SSIBusy(SSIBASE));
ROM_SSIDataGet(SSIBASE, &rxData);
return (uint8_t) rxData;

}

 

for v13  at line 249 SPI.cpp is :

{

unsigned long rxtxData;
rxtxData = data;
if(SSIBitOrder == LSBFIRST) {
asm("rbit %0, %1" : "=r" (rxtxData) : "r" (rxtxData)); // reverse order of 32 bits 
asm("rev %0, %1" : "=r" (rxtxData) : "r" (rxtxData)); // reverse order of bytes to get original bits into lowest byte 
}
ROM_SSIDataPut(SSIBASE, (uint8_t) rxtxData);
while(ROM_SSIBusy(SSIBASE));
ROM_SSIDataGet(SSIBASE, &rxtxData);
if(SSIBitOrder == LSBFIRST) {
asm("rbit %0, %1" : "=r" (rxtxData) : "r" (rxtxData)); // reverse order of 32 bits 
asm("rev %0, %1" : "=r" (rxtxData) : "r" (rxtxData)); // reverse order of bytes to get original bits into lowest byte 
}
return (uint8_t) rxtxData;

}

 

The changes are minimal, but the real difference is in the new WiFi folder. 
In the E0012 version, the Wifi folder does not exist and the library to access the BoosterPack CC3000 is in the SimpleLinkWifi library. 
With the new version of E0013 to work successfully on BoosterPack CC3000 , the SPI folder version E0013 must be replaced by the SPI folder from version E00012. 
We must remove the Wifi library and replace it with SimpleLinkWifi library. 
There is an incompatibility between this library and the SimpleLink Wi-Fi library because names  are identical between the two libraries ( Wifi.h  andWifi.cpp) files. 
If these changes are made, then the CC3000 module works under the E0013 release. 
This poses a problem of compatibility and is quite annoying when using this wireless module for industrial applications.

I have an application on the platform TIVA 1294  which switches automatically at start-on  to the CC3000 wifi module if the Ethernet cable is unplugged.

I do not wish to remain with E0012 version because of this problem!!!

Share this post


Link to post
Share on other sites

Oh gotcha - the SPI changes enable LSB mode on ARM devices (using some ASM to perform the reversion since the Tiva and CC3200's do not natively support LSB-mode in their SPI peripherals), but shouldn't otherwise affect anything else since the API works the exact same way.

 

Do you have the errors that get output when you use the SimpleLinkWiFi library with the "new" SPI folder?

Share this post


Link to post
Share on other sites

Unfortunately, there is no error, but the program remains stuck in the routine WiFi.begin (SSID, password);

Tomorow i work on debugging  the new SPI.cpp  to understand the difference between the two files version from E0012 and new version.

 You are right, the two libraries are similar!

I'll let you know.

Share this post


Link to post
Share on other sites
I return to the problem of the SPI library. 

I finally connected a logic analyzer on the SPI signals with an TIVA Launchpad (Stellaris 80 MHz) coupled to CC3000 Wifi module. 

 

Here are the notes: 

-1 I found that the new library has changed the SPI clock frequency to a value of 4 MHz for  compatibility  with Arduino. 

Unfortunately this value blocks the initialization for the CC3000 boosterpack . 

 

It is not logical for a SPI bus but the module work correctly  with a clock speed of 6 MHz up to 16 MHz value. 

 

-2 I also noticed that the VBAT-SW-IN signal was controlled by the SPI signal SSInFss which is illogical. 

Indeed it goes in low state for each clock train (8 cycles), which has normally the effect of stopping the normal operation of the module (according to Texas). See Image DSC00261. But in this case it's work perfectly!!!!!!!

I finally forced up signal all the time (with no change but it's logical for me to have this signal High). 

 

-3 The SPI signal SSInTX goes in high impedance  during off  cycle, which means that the corresponding input of CC3000 is floating when the chip select is already low .This is not necessarily good at electronics level. 

 

Initializing the SPI clock frequency with an low value ( in Energia E0013) prevents a user to  change the frequency up through   the function setClockDivider !!!

 

The new version with the removed  SimpleLink CC3000 library for BoosterPack no longer allows use. 

The new library WIFI only works with CC3100 module and CC3200.

 

I am interested in other opinions and remarks.

post-31147-0-35837900-1411314255_thumb.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...