Jump to content
43oh

calinp

Members
  • Content Count

    46
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by calinp

  1. 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. 

  2. 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!

  3. 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

  4. 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_3

     

    About 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

  5. 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

  6. 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

  7. 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

  8. 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

    FatFs_SpeedTest.txt

    FatFs05.zip

  9. 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

     

     

    PFatFs10.zip

    PFatFs_SpeedTest.txt

    PFatFs_SpeedTest430.txt

  10. 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
×
×
  • Create New...