Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

State machine design for a data logging sensor( CAN bus logging sensor)

Status
Not open for further replies.

priombiswas22

Newbie
Joined
Oct 5, 2021
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
23
I have the following requirement to design behaviors of two software components, one for writing data to SD card and another for controlling the LED based on the mode of SD card:

Datalogging sensor can write data to a FAT16-formatted SD card that is inserted into the card reader slot. When the board is booted and a valid card is detected, a new file is created and data from all messages on the can bus is written into this file. There is no mechanism to specifically close the log file. Just remove the card or power down the board. There is a bootloader in the board which checks whether the SD card is valid or invalid and sends signal to datalogging sensor accordingly.

I have come up with the following state chart:
LoggingControl.png


To control the LEDs, there are two LEDs. I have following requirement: LED "LOGGER ON" When this LED is on, the SD card is present, has been detected and the file could be opened for writing. LED "LOGGER WRI" This LED blinks once each time a 512 Byte sector is dumped to the SD card. The Write LED is turned on after the SD card has been initialized. If it stays on and the "LOGGER ON" LED stays off, the file system could not be initialized. Most likely this means that the SD card has the wrong format, but for some reasons even if the format is correct, filesystem initialization always fails on some cards. I have come up with following state chart:

LEDLoggerControl.png

Are my models correct?

I have thought about my architecture design like below:
I have specified a bit further on my own: Bootloader will send the signals (SDCardValid and SDCardInvalid) whether a sd card is valid or invalid. If logging sensor receives valid signal, and there are error messages present, sensor will write the data to sd card and notifies the systemcontroller that the sd card is in write mode via SDCardWRI signal. If sd card is invalid, logging sensor notifies the systemcontroller that there is problem with the sd card with SDCardProblem signal.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top