This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Real Time Clock on DM355

Other Parts Discussed in Thread: TMS320DM355

i thought i had seen a topic related to the RTC of the Board provided by the msp430 but i cant find it anymore...

Could you help me setting up the time and date? During power disconnection its buffered by the on board battery i think?

Bye alex

  • The RTC was mentioned in an I2C error thread but I think that is about it. You should be able to set the time and date in the MSP430 by using standard Linux commands like seen here, the underlying RTC driver should take care of the I2C communication with the MSP430 to get the actual time set. Note that to keep the time through a power cycle you need to have a battery in the battery socket of the EVM (a big round watch battery) otherwise the MSP430 loses the time every power cycle.

    If this does not work please let me know, I do not have a battery to verify it myself here, and in older DM6446 DVEVM boards the MSP430 firmware had a bug that prevented the RTC from working properly, though I believe this was fixed with DM355.

  • The DM355 EVM does include Real Time Clock functionality and it is provided by the MSP430.  The following site at Spectrum Digital provides the documentation.

    http://c6000.spectrumdigital.com/evmdm355/revd/

     

    The TMS320DM355 Evaluation Module Technical Reference Manual provides some description of the support for the RTC and that there is a capability of battery backup.

  • Bernie Thompson said:

    The RTC was mentioned in an I2C error thread but I think that is about it. You should be able to set the time and date in the MSP430 by using standard Linux commands like seen here, the underlying RTC driver should take care of the I2C communication with the MSP430 to get the actual time set. Note that to keep the time through a power cycle you need to have a battery in the battery socket of the EVM (a big round watch battery) otherwise the MSP430 loses the time every power cycle.

    If this does not work please let me know, I do not have a battery to verify it myself here, and in older DM6446 DVEVM boards the MSP430 firmware had a bug that prevented the RTC from working properly, though I believe this was fixed with DM355.

    Hi Bernie

    I put a 20mm watch battery (CR2032) into the socket. I am able to set via "date" the actual time an date according to your link. But step 5 "clock -w" or "setclock" wont work, the isnt such a command. If i unplug powerconnection and plug it back the board throws me an I²C error. I have to use the reset key to restart the board and so my date is setted back to 1970.

    So if i understand it right, with "date" i only set the linux software clock. And i have to write it to msp430 for setting the hardware clock. But how it wont work mentioned in your posted link.

    @BrandonAzbell, the technical reference manuall doesnt provide much informations about the rtc. Only that the rtc is generated by the msp430 and the I²C address. But i dont which API i have to use for accessing the I²C and do something with the I²C functions.

    Alex

  • Alex said:

    @BrandonAzbell, the technical reference manuall doesnt provide much informations about the rtc. Only that the rtc is generated by the msp430 and the I²C address. But i dont which API i have to use for accessing the I²C and do something with the I²C functions.

    There is an example library with functions to interact with the MSP430 over the I2C interface.  This is found in the DVSDK in dvsdk_1_30_00_40\demos\dm355\utils\msp430lib.  Examples of how to use these APIs are in the demos\dm355\encode as it relates to detecting IR remote button presses, etc.

  • Hello

    i had a look at msp430lib.c and msp430lib.h and i found the two commands for the RTC but they arent defined for the dm355 ("#ifndef DM355").
    Thatswhy i cant compile it using this two functions.

    If i copy the msp430lib.h msp430lib.c and i2c-dev.h into my programm directory and remove the "ifndef" line i am able to compile the programm, but i cant read the RTC.
    The Error is within the "if (buf[0] != 9 || buf[1] != 1) {}" statement.

    Alex

  • Alex said:

    If i copy the msp430lib.h msp430lib.c and i2c-dev.h into my programm directory and remove the "ifndef" line i am able to compile the programm, but i cant read the RTC.
    The Error is within the "if (buf[0] != 9 || buf[1] != 1) {}" statement.


    What is returned in buf[0] and buf[1] when the msp430lib_get_rtc() is called?

  • as far as i remeber, there was output 3 and 0. buf[0] was 3 and buf[1] was 0.

    But its not important to me anymore, cause i have writtenmy own rtc get and set function, cause i have found a document "EVMDM355-ECPRegisterDefinitions_VA3.pdf" in which i found the for me necessary informations to use the I²C API. And it works fine to me, but i have another question...

    I think the msp430lib.h, msp430lib.c and the i2c-dev.h is under /demo/utils/msp430 at home. If i made changes to these three files, and compile my project, there isnt any change...
    i include it with <msp430lib.h>. So i think the compiler uses another msp430lib.h? But where is it? i scanned the hole drive and couldnt fine another files with this name. If i copy these 3 files into my project directory and include it with "msp430lib.h" i got my changes...

    Bye Alex

  • i have also another question.

    If no programm is running on the DM355 and i will push some buttons on the remote control or at the board, they will be recognized, if i now start my programm, these pushes will be executed.
    Is there a possibility to clean up the IR register inside msp430 at startup? Over I²C there is only read access to these registers...

    I could build a routine that in the first few seconds there is no command accepted, but i think this isnt a very good solution :)

    greetings

     

    edit:

    Ok, i wrote now a function which calls for IR inputs befor my programm goes into main loop, i think i can live with it, but i am still interessted if there is a chance to access the registers directly or if there is another, cleaner method to avoid this issue.

  • If your build is including another msp430lib.h than copying the one you want to use into your source directory is a fine way to resolve the issue. If you want to find the msp430lib.h you were mistakenly including you may want to look at your make file and check your search paths (i.e. VPATH) to see what directories it looks in and in what order, from that you should be able to look exactly where make does to find the header file.

    As to clearing out the msp430 events at your program start up, having your code check and throw out any spurious events that happened before your code was ready seems like a fine solution, I have not dug deeply into the msp430 source code but I believe this is how it was designed to be used. You can actually get the MSP430 firmware used on the EVM at the bottom of the Spectrum Digital support page for the DM355 EVM, with this you could modify the MSP430 source so it better suits your application if that is necessary.

  • Ok thanx for your advise. I will try finding these files.

    alex

  • Hi.

    I want to access RTC on DM355 EVM. I have tried to access RTC (using I2C on MSP430) using DM355 SDK MSP430 example from "/dvsdk_1_30_00_40/demos/dm355/utils/msp430lib". In this code i found RTC APIs only for #ifndef DM355. But i have removed that #ifndef and compiled that code on my board. It got compiled and i tried to set and get RTC but i am getting error " get_rtc - Failed to read RTC ACK from device [got 0x70] ". It succeeds in RTC SET but can not get ACK for RTC GET function.

    What can i do to read and write RTC through DM355?

    -Chirag Shah

  • Hi

    i had the same problem, and i found a pdf file called "EVMDM355-ECPRegisterDefinitions_VA3.pdf" this was very helpful to me. But dont ask me were on the ti page i found this one....
    With this pdf and the msp430lib.c file, i was able to wrote my own rtc_set and rtc_get function.

    there are 4 registers for the rtc to save the unixtimestamp and increment it every second... their adresse offsets are from 0x12 to 0x15. 0x12 is byte 0 and 0x15 is byte 3...

    Have a look at the get_ir_val function in msp430lib.c and you will be able to wrote your own one...

    bye alex

  • Alex said:

    i had the same problem, and i found a pdf file called "EVMDM355-ECPRegisterDefinitions_VA3.pdf" this was very helpful to me. But dont ask me were on the ti page i found this one....
    With this pdf and the msp430lib.c file, i was able to wrote my own rtc_set and rtc_get function.

    The PDF file mentioned is located on the Spectrum Digital Support site for the DM355 EVM.  http://c6000.spectrumdigital.com/evmdm355/revd/

     

  • Alex / ChiragShah

    Have you guys placed a battery on DM355 EVM as suggested in the technical reference manual: http://c6000.spectrumdigital.com/evmdm355/revd/files/EVMDM355_TechRef_RevD.pdf

    RTC will not work if there is no battery present.

  • Hi Brandon,

    I got the same error as Alex got while reading RTC from DM355. I also put battery on DM355.

    I am gettign error at  "if (buf[0] != 9 || buf[1] != 1)" statement and it is returning buf[0] = 3 and buf[1] = 0.

    What should be the problen in reading as my read call is returning as 9 which is my read count. But in read message buffer i am not getting 9.

     

    -Chirag Shah

  • @Juan: Yes i have a battery there and my RTC works fine. I have no problem with it :)

    @Chirag Shah:
    Those Functions "msp430lib_get_rtc()" and the "msp430lib_set_rtc()" wont work for the DM355.
    You have to wrote your own one. At first you have not only one Buffer for the RTC, there are 4 Buffers.
    And they have another Offset. They are form 0x12 to 0x15, not on 0x09.

    So i Wrote my own Function to set the RTC using this call: "write(msp430lib_fd, &value, 2);"
    I use this 4 times, for every Buffer. You can use a loop for this.
    In "value" is the Bufferadress and the Buffervalue. For example: "value[0] = 0x12;" and "value[1] = 0xFF";

    The same for teh other 3 Buffers, now you have a 4 byte long digit, which is used for the timestamp.
    Have a look at "unixtime" for more informations about these number.

    If you want to read the RTC, its almost the same procedure. For this you may be have a look at the function
    "get_ir_val()". You first have to write your adress, here for example 0x12. and then you read the I²C Device,
     for example: "read(msp430lib_fd, &retvalue, 1);"

    Now you have a 1 byte digit inside of retvalue, its the content of buffer 0x12. You should read now 0x13, 0x14 and 0x15.
    Now you have a 4 byte digit again, the "unixtimestamp".

    This is easyly calculated into a humand readable format with some C-Functions out of the time.h Headerfile.

    I hope this will help you a little bit.
    Alex

  • Hi Alex,

    Thanks for your reply.

    I want  to ask that, "Have you enabled any Real Time Clock device (Like Ds1338 or something) " in your kernel driver configuration?

    -Chirag

  • hm no i dont think i did that.
    Whats this device for? Didnt hear it befor...

    Alex

  • ChiragShah said:

    Hi Alex,

    Thanks for your reply.

    I want  to ask that, "Have you enabled any Real Time Clock device (Like Ds1338 or something) " in your kernel driver configuration?

    -Chirag

     

    RTC is enabled by default; the battery just helps preserve the time that is set as opposed to having time being reset after every power cycle.

  • Hi Alex,

    Thanks for your help.

    It works fine for me. I was making mistake while writting RTC not in reading.

    Thanks again.

    Chirag Shah