Logger to USB stick running on KL25Z
Dependencies: F401RE-USBHost FastAnalogIn RTC mbed tsi_sensor2 mbed-rtos2
Fork of ReadSendData by
Homepage for kXX_logger(was kl25x_usb_logger)
2014Nov12 - Added TSI - only works for kl25z, and fails after 4287seconds
Tests sequences for freezing 4287seconds 4287 4287 - Changed to USB write update every two seconds and lasted 4283seconds. Added mbed TSI_sensor - kudos to mbed as it turns out to be complex to do capacitive touch sensing. Kinetis L series Cortex-M0 (kl25z) has simpler capacitive sensing hardware which mbed/TSI_sensor lib uses, but doesn't support Cortex-M4 versions. K20D is older more complex interface. TSS hasn't had an open source support by Freescale in the past however that has changed. Currently I found KDS1.1.1 has a Processor Expert TSSlib that can be imported - but I'm getting a weird compile/include error - and not found any examples of how to make it work.
2014Oct05 - Published simple kl25z_usb_logger
Testing: Version (2:f06fbf86887e) has run over 28days starting 2014Sept07, reading a sensor data every seconds and then on the USB stick open file, write record, close file
This is over 2,419,200seconds ( 28days*24hrs*3600seconds) The stick data reflected 2,447,633 seconds, but only had 1,776,366 data records. After 407,650 data records started missing updates - analysis: the file could not be opened and read to the end in the allocated 1 second, and therefore missed the next ADC deadline.
By the end of the test period with 1,776,366 records on the USB Stick, ever read then write was causing it to miss two/three ADC updates - ie taking longer than two seconds.
Analysis: this was an aggressive test, and normally would not be opening, writing, closing every 1 second. However big plus the file mechanism held up and the program continued to operate, with a graceful failure of a missed ADC readings. The output used JSON, which reads nicely but turns out not to be supported by Excel (2014?) I was using.
Conclusion: Overall the USB Mechanisms and file read is stable. However the USB stack used doesn't have an event based management for stick insertion and removal, or OTG power management . This KL25Z has been a very useful test to prove the configuration of clocks for USB Stack is possible and stable. The target processor being looked at is the MK20 and is similar in clocks, but slightly more comprehensive USB OTG Next step is to investigate the full Freescale Kinetis USB OTG Stack with power management on a custom K20 board, using Kinetis Design Studio, and very low power capability.
Example https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/FRDM-K20D50M/FRDM-K20_MSD_Host http://mcuoneclipse.com/2014/10/25/usb-cdc-with-the-frdm-k64f-finally/#comment-37727 - Commentary on Freescale USB versions
board_cust.h
- Committer:
- neilh20
- Date:
- 2015-05-19
- Revision:
- 15:91ef840c442c
File content as of revision 15:91ef840c442c:
/* Custom board descriptions */ #ifdef BOARD_CUST_H #define BOARD_CUST_H /* CustomMK20DX128 Customer Visible interfaces - NH B022_Rev1 //R-Bridge sensor DacOut senseRaDrv (connected electrically ADC_DP0) ADC0_DP0 adcDiffInP0 ADC0_DM0 adcDiffInP1 senseRbAdcP ptB1 adcIn adcTemperature1 ptB2 adcIn adcTemperature2 ptB0 adcIn adcAir ptB16 out CustLedRed ptB17 out CustLedGrn ptB18 cap capSens1 ptB19 cap capSens2 */ /* Internal LiIon management interfaces ptA13 digOut enExtBat ptB3 adcIn adcVrechargeBat ADC0_DP3 adcIn adcRbatP ADC0_DM3 adcIn adcRbatM ptc0 adcIn adc10Vbat ptC1 spare */ /* External Power Management ptC2 adcIn adcVextIn ptC8 adcIn adc10Vslr */ /* Serial North Bound Interfaces Shared Uart1Tx Halfduplex enSdiTx enSdiRx enWire1Tx enWire1Rx */ /* USB OTG Vusb (input to cmpUSB UsbDM UsbDP UsbOtg_Id */ /* External Two FLASH chips. ptc3 C4 C5 C6 C7 */ /*Debug Serial Interafaces either JTAG or openSDA ptA0 SWD_CLK pta1 Uart0RxDebug pta2 Uart0RxDebug pta3 SWD_DI0 */ #endif // BOARD_CUST_H