
calinp
-
Content Count
46 -
Joined
-
Last visited
-
Days Won
1
Posts posted by calinp
-
-
Hi bkb,
I think this error is caused by these changes in the SPI library :https://github.com/energia/Energia/commit/4b5ebc4370afd426a41dfe3cc6bbaafbeb764f04
Try to edit fatfs.cpp at line 151 to replace SPI.begin(9); with SPI.begin();
I still use ENERGIA 0101E0009 but next year I will try this lib on ENERGIA 0101E00011
Calin
-
For writing function to work, the file must be created in advance with a size >0. This library can not resize, delete files or change their attributes.
For lseek to work you shoud keep in mind that writing with petit fatfs can start only at the begining of a sector, so the pointer shoud go to the next sector in case data needs to be written again.
Let's say you write 150 bytes in a file and close it. when the file is opened again for write, lseek shoud have 512 as argument.
If one wants to write a single byte and uses lseek(151), then writing will start at the beginning of the same sector and will overwrite the already existing 150 bytes because when a file is closed, the remaining bytes in the sector are filled with nulls.
Writing with this library is very restricted but I think it is the only one that can work in less than 512 Bytes of ram.
-
Check these threads:
http://forum.stellarisiti.com/topic/442-energia-library-stellaris-launchpad-fatfs-energia-library/
http://forum.stellarisiti.com/topic/455-energia-library-petit-fatfs-sd-card-library/
In Stellarisware the path to the FatFs library is \StellarisWare\third_party\fatfs and the example is located in \StellarisWare\boards\ek-lm4f232\sd_card
Calin
-
Hi, there are 2 sd libraries for Energia in the dedicated subforum( PetitFatFs and FatFs). You can also find an example of implementing the FatFs library on LM4F in Stellerisware ( or Tivaware)
-
Hi russcky,
The Petit FatFS library does not support multiple files open. You can find more information on http://elm-chan.org/fsw/ff/00index_p.html .
Searching with lseek works, but is very slow to do this multiple times.
This library supports a forwarding function that I did not implement (check the examples from the link for an implementation).
Calin
-
Hi,
In Energia the clock is set to 80MHz in wiring.c file, exactly as you did.
Calin
-
For windows you can use the command described below:
http://technet.microsoft.com/en-us/library/cc788058.aspx
The file you are writing to, must exist on the card and be big enough for your needs.
Calin
-
Thanks!
-
New release available !
Check http://energia.nu/
-
Hi volodink,
For that speed you have to use another microcontroller that supports "Four-Bit SD Bus Mode" (https://en.wikipedia.org/wiki/Secure_Digital#Technical_details).
Regards,
Calin
-
Hi,
Actually Chip select pin is on Port A, Pin 3 - "#define SDC_SSI_FSS GPIO_PIN_3".
I think I can try your build with Chip Select on pin 6.
Calin
At the first run the SD support is working. I can succesfully list the files on the SD Card !
Next i will try to create and edit some files.
The card is connected as I posted earlier, with CS on Port A, Pin 3.
Thanks!
-
Hi,
I think that in rpm_fun you should get timestamps to compute the time between sparks instead of counting pulses.
Anither ideea would be to use pulseIn to get the duration ( measure both high and low pulses). This method will do measurements on differen pulses, but as the engine is a slow system compared to the microcontroller, this should not be a problem.
Calin
-
Hi Igor,
I can confirm that you can upload programs to the /wo file system and run them from there. As i understood from the documentation, the /romfs can be used to include external programs/modules at compile time. For me, the SD card would enable datalogging
I have a SD card connected on SPI0 on default pins on portA:
#define SDC_SSI_CLK GPIO_PIN_2
#define SDC_SSI_TX GPIO_PIN_5
#define SDC_SSI_RX GPIO_PIN_4
#define SDC_SSI_FSS GPIO_PIN_3About the ADC, there are two converter modules that share 12analog input channels. I think with eLua I can access only analog channels 0 and 1 (and the temperature mesurement channel) and it gives an error if I try to access others. Maybe you can rebuild eLua with more channels enabled.
Thanks,
Calin
-
Hi Igor,
I have successfully flashed the eLua image on my Stellaris Launchpad and it seems to work as expected.
I could run some sample applications with minor changes without issues.
I have some questions:
- how much ram is available in eLua on Stellaris?
- will you support an sdcard in the future?
- why only 2 ADCs?
Thanks,
Calin
-
Hi Rei,
Did you checked miso, mosi, sclk, ss signals during a byte transmissio on all SPI modules ? Maybe the SPI mode or the SS pin are not configured correctly and the slave does not recognize what is sent to it.
-
Hi Rei,
I have seen some erratic behavior when using SPI0, but I assumed it is because of my wiring and not driving the pins with enough current. The first library I posted used a SPI driver for the SD card taken from the Stelarisware and it worked fine.
Also I checked the library only on SPI 0 and 2.
Given your detailed analysis on this problem I think it is an initialisation problem that must be addressed to the Energia developers.
Thank you for your effort.
Calin
-
Hello,
I will do some check on this.
Try to use the printf function for writing in files (needs to be enabled in ffconf.h, _USE_STRFUNC 1). Also disable the print support ( _USE_PRINT 0)
-
I looked again the picture and there is no need to supply 5V from USB to the SD board.
Try with FatFs.begin(cs_pin,16); this will lower the SPI clock
Check if your Energia/hardware/msp430/libraries/SPI/utility/usci_spi.cpp and Energia/hardware/msp430/cores/msp430/usci_isr_handler.c files are the same as the ones in github.
Calin
-
Hi Sirri,
From the pictures I think you are using an SD adapter that have level shifting so it can interface to 5V microcontrollers (like Arduino).
This will not work, because the MSP430 is a 3.3V device and the voltage levels from the card will be to low.
Try to connect the card directly using the first method from http://www.43oh.com/2011/02/five-cheap-breadboard-prototyping-tips-and-tricks-list-2/
( this is what I used )
Regards,
Calin
-
Hi Samuel,
I found an error in that example. Please change char buffer[2048]; to char buffer[16384]; .
I updated the zip file with this change.
Thanks,
Calin
-
Hi Rei,
I found a I2C software lib for Arduino and after making the necessary changes it seems to work. At least it detects the address range of a small eeprom using the included example.
The original with more examples is at http://forums.adafruit.com/viewtopic.php?f=25&t=13722
Calin
-
Update to support the SPI driver and different SSI modules:
- FatFs.begin(cs_pin) -> defaults to SSI2 and maximum SPI clock
- FatFs.begin(cs_pin, clock_divider) -> SSI2 and SPI clock is divided by clock_divider.
- FatFs.begin(cs_pin, clock_divider, module) -> SPI clock is divided by clock_divider, new SSI module selection
- inherited print functions ( can be enabled in ffconf.h )
Pin 9 is used as CS inside the SPI library and it is toggled at each byte transferred so it can't be used by FatFs.
I made some tests with CS control disabled inside the SPI lib and the transfer speed increases by ~50%.
If the card can't be initialized, a possible solution is a 1K pull-up resitor from MISO to VDD.
Because this library doesn't use low level access to hardware it shoul be compatible with further boards supportded by Energia (with enough RAM).
Calin
[EDIT] corrected the speed test example
-
A small update:
- all config settings in one file - pffconf.h
- a soft SPI driver ( shuftIn/shiftOut ) that can be enabled in pffconf.h. It defaults on HW SPI pins, but these can be changed using FatFs.begin(cs_pin, sclk_pin, mosi_pin, miso_pin); . The speed is very low, but it frees 3 pins that can be used as analog inputs or I2C.
- added a small benchmarking example
Tested on MSP430G2553 and Stellaris Launchpads. A minimal program should work also on MSP430G2452.
On fraunchpad the examples compile without errors but I don't have the board to test it.
Calin
-
Hi Sirri,
Check this Energia library to see how you can get timer interrupts without disturbing PWM (and tone) generation: http://forum.43oh.com/topic/2861-energia-library-mstimer2/
Or try using a different pin. According to pins_energia.h "On the 20pin devices, upto 3 analog outputs are available
T0A1, T1A1 and T1A2 "T1A0, /* 8 - P2.0 note: A0 output cannot be used with analogWrite */T1A1, /* 9 - P2.1 */T1A1, /* 10 - P2.2 */T1A0, /* 11 - P2.3 note: A0 output cannot be used with analogWrite */T1A2, /* 12 - P2.4 */T1A2, /* 13 - P2.5 */Regards,Calin
SimplelinkWifi Library with BOOSTXL-SENSHUB + CC3000
in Energia - MSP
Posted
Before making any changes to the library, check last post in this thread about fatfs library: http://forum.stellarisiti.com/topic/442-energia-library-stellaris-launchpad-fatfs-energia-library/page-2#entry5567
It looks like SPI module 0 is correctly initialized (and functional) on Energia 11.