Page 2 of 2

Re: SD card file write

Posted: Sat Mar 04, 2017 4:07 am
by SureshVakati
Yeah.. it's 32 kHz, I need to check with scope on Monday.

Sent from my ONEPLUS A3000 using Tapatalk

Re: SD card file write

Posted: Sat Mar 04, 2017 4:46 am
by dhylands
And make sure that it's actually oscillating while you're experiencing the time returning zero. With this type of circuit the act of testing with the scope can make the circuit work.

Re: SD card file write

Posted: Thu Mar 09, 2017 10:29 pm
by SureshVakati
When I run Clock Diagnostics using bootloader, it seems External crystal is running.

Code: Select all

BL>C
ClockDiagnostic
SYS:168000000 H:168000000, P1:42000000, P2:84000000
LSI:31264, LSE:32772
PLL Source

BL>C
ClockDiagnostic
SYS:168000000 H:168000000, P1:42000000, P2:84000000
LSI:31239, LSE:32769
PLL Source
Micropython time module returns 0, I reinstalled the firmware, still it does the same thing.

Code: Select all

>>> import pyb, time, os
>>> rtc = pyb.RTC()
>>> rtc.info()
262147
>>> rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
>>> print(rtc.datetime())
(2000, 1, 1, 1, 0, 0, 0, 0)
>>> time.time()
0
>>>
>>>

Re: SD card file write

Posted: Fri Mar 10, 2017 2:03 pm
by SureshVakati
Changed this in stmhal/main.c (false>true), seems RTC is running okay now.

Code: Select all

#if MICROPY_HW_ENABLE_RTC
    if (first_soft_reset) {
        rtc_init_start(true);
    }
#endif
rtc.c has some timeout values, is anything timing it out before initialization?

Code: Select all

#define PYB_LSE_TIMEOUT_VALUE 1000  // ST docs spec 2000 ms LSE startup, seems to be too pessimistic
#define PYB_LSI_TIMEOUT_VALUE 500   // this is way too pessimistic, typ. < 1ms


Re: SD card file write

Posted: Sun Apr 30, 2017 2:08 pm
by holdenweb
dhylands wrote:If you're writing to the sdcard from pyboard, then you really need to make sure you disable USB Mass Storage, otherwise you will get file corruption from the PC also overwriting the data that the pyboard wrote.
Only just seen this. Perhaps it explains why a couple of times I've had the experience of files being transmogrified to contain all 1s?

Perhaps bozos like me could be reminded somewhere in capital letters ... ;-)

regards
Steve

Re: SD card file write

Posted: Mon May 01, 2017 8:16 am
by pythoncoder
I think the official docs should discourage the use of MSC mode and point users to tools such as rshell. If it were up to me I'd disable it by default on new boards. But I guess people expect a USB device to appear as a disk...

It's a source of needless problems.