Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MSP-EXP430F5438 board and Improvment in Timer/Watchdog/Ports/Flash #29

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
63589e5
Hold flash after restart mspsim
roy77 Nov 20, 2013
9540d85
Support MSP-EXP430F5438 board
roy77 Nov 20, 2013
d61dc73
Watchdog Interval Timer Interrupt Bug
roy77 Nov 21, 2013
c0d6c8e
PxSEL and PxSEL2 Support
roy77 Nov 21, 2013
0118e6f
Timer and Watchdog improvments
roy77 Nov 22, 2013
e250c44
Bugfix for Flash
roy77 Nov 22, 2013
92d13f7
Bugfix for IOPort PxSEL/PxSEL2
roy77 Nov 22, 2013
c09c17b
Merge branch 'master' of https://github.com/roy77/mspsim
roy77 Dec 9, 2013
fc19cdd
- Support extra features Timer B
roy77 Jun 19, 2014
55443d5
shorter cycle sleep time interval for better time resolution
Sep 19, 2014
a6015ab
Set speed to 1
Oct 14, 2014
b4116a1
improve gdbstubs
Nov 4, 2014
b7b1e60
Show button states
Nov 12, 2014
95890ca
Exit on AbstractNodeGUI close
Dec 18, 2014
7a30467
Improve gdbstubs
Dec 18, 2014
98a4dbb
Comment out System.out ind GDBstubs
Jan 14, 2015
243797e
Revert "Comment out System.out ind GDBstubs"
Jan 14, 2015
c8c2b69
Possible values for portwrite 0,1,x
Oct 7, 2015
917b084
GDBStubs now compatible to msp430-elf-gdb (Red Had)
Oct 21, 2015
9bf18db
Flash File now saved in Hex ASCII
Nov 16, 2015
e6558ac
Flash File now saved in Hex ASCII - Improve performence
Nov 16, 2015
8229102
Improved Timer
Nov 19, 2016
d76b937
Improve calculation of display frequency
Dec 16, 2016
bb77ef3
Solve crash when using watchdog WDTIS=0
Dec 16, 2016
695fff2
gdb memory changes are recognized
Jul 31, 2017
7e8a3a1
Sel change output only if direction is set to output
Sep 30, 2017
207693b
Improved display timing
Sep 30, 2017
d41d5ea
Bug HighOpen Button output with wrong resistor (pulldown) is sometimes
Oct 2, 2017
dbd7fe1
Improved timer and selection (PxSEL) handling
Nov 16, 2018
a7cbb6d
Improved watchdog and flash
Sep 30, 2019
7ed2bc2
edit version number
Sep 30, 2019
c7fa02c
CCR update only timer when CCR value is changed
Apr 19, 2021
3a5477c
Windows are always visible on start
Apr 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -62,13 +62,15 @@ Z1FIRMWARE = firmware/z1/blink.z1
WISMOTEFIRMWARE = firmware/wismote/blink.wismote
TYNDALLFIRMWARE = firmware/tyndall/blink.tyndall
EXP5438FIRMWARE = firmware/exp5438/testcase-bits.exp5438
MSPEXP430F5438FIRMWARE = firmware/mspexp430f5438/LCDflat.out
else
ESBFIRMWARE = ${FIRMWAREFILE}
SKYFIRMWARE = ${FIRMWAREFILE}
Z1FIRMWARE = ${FIRMWAREFILE}
WISMOTEFIRMWARE = ${FIRMWAREFILE}
TYNDALLFIRMWARE = ${FIRMWAREFILE}
EXP5438FIRMWARE = ${FIRMWAREFILE}
MSPEXP430F5438FIRMWARE = ${FIRMWAREFILE}
endif

ifdef MAPFILE
@@ -81,7 +83,7 @@ TIMERTEST := tests/timertest.firmware
SCRIPTS := ${addprefix scripts/,autorun.sc duty.sc}
BINARY := README.txt license.txt CHANGE_LOG.txt images/*.jpg images/*.png firmware/*/*.firmware ${SCRIPTS}

PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core chip cli config debug platform ${addprefix platform/,esb sky jcreate sentillausb z1 tyndall ti wismote} plugin profiler emulink net ui util extutil/highlight extutil/jfreechart}
PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core chip cli config debug platform ${addprefix platform/,esb sky jcreate sentillausb z1 tyndall ti MSPEXP430F5438 wismote} plugin profiler emulink net ui util extutil/highlight extutil/jfreechart}

SOURCES := ${wildcard *.java $(addsuffix /*.java,$(PACKAGES))}

@@ -122,6 +124,10 @@ $(JARFILE): $(OBJECTS)
%.exp5438: jar
java -jar $(JARFILE) -platform=exp5438 $@ $(ARGS)

%.mspexp5438: jar
java -jar $(JARFILE) -platform=exp5438 $@ $(ARGS)


%.tyndall: jar
java -jar $(JARFILE) -platform=tyndall $@ $(ARGS)

@@ -154,6 +160,8 @@ runwismote: compile

runexp5438: compile
$(JAVA) $(JAVAARGS) se.sics.mspsim.platform.ti.Exp5438Node $(EXP5438FIRMWARE) $(MAPARGS) $(ARGS)
runmspexp5438: compile
$(JAVA) $(JAVAARGS) se.sics.mspsim.platform.MSPEXP430F5438.Exp5438Node $(MSPEXP430F5438FIRMWARE) $(MAPARGS) $(ARGS)

test: cputest

Binary file added firmware/mspexp430f5438/LCDflat.out
Binary file not shown.
Binary file added images/MSP-EXP430F5438.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions se/sics/mspsim/Main.java
Original file line number Diff line number Diff line change
@@ -75,6 +75,9 @@ public static String getNodeTypeByPlatform(String platform) {
if ("exp5438".equals(platform)) {
return "se.sics.mspsim.platform.ti.Exp5438Node";
}
if ("mspexp430f5438".equals(platform)) {
return "se.sics.mspsim.platform.MSPEXP430F5438.Exp5438Node";
}
// Try to guess the node type.
return "se.sics.mspsim.platform." + platform + '.'
+ Character.toUpperCase(platform.charAt(0))
128 changes: 94 additions & 34 deletions se/sics/mspsim/chip/Button.java
Original file line number Diff line number Diff line change
@@ -31,51 +31,111 @@
package se.sics.mspsim.chip;
import se.sics.mspsim.core.Chip;
import se.sics.mspsim.core.IOPort;
import se.sics.mspsim.core.IOPort.PortReg;
import se.sics.mspsim.core.MSP430Core;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
* @author Niclas Finne
*
*/
public class Button extends Chip {
public class Button extends Chip implements ActionListener {

public enum Btn_Typ {
HighOpen, NoOpen
}

private final IOPort port;
private final int pin;
private final boolean polarity;
private boolean isPressed;
private Btn_Typ btnTyp = Btn_Typ.NoOpen;
private javax.swing.Timer waittimer;

public Button(String id, MSP430Core cpu, IOPort port, int pin, boolean polarity) {
super(id, cpu);
this.port = port;
this.pin = pin;
this.polarity = polarity;
this.isPressed = false;
if (this.polarity == false) {
SetState();
}
}

public Button(String id, MSP430Core cpu, IOPort port, int pin,
boolean polarity, Btn_Typ btnTyp) {
this(id,cpu,port,pin,polarity);
this.btnTyp = btnTyp;
waittimer = new javax.swing.Timer(3000, this);
waittimer.stop();
waittimer.setRepeats(false);
}

public boolean isPressed() {
return isPressed;
}

public boolean isPullUp() {
boolean Ren = ((this.port.getRegister(PortReg.REN) & (1 << this.pin)) != 0);
boolean Up_Down = ((this.port.getRegister(PortReg.OUT) & (1 << this.pin)) != 0);
return Up_Down & Ren;
}

private final IOPort port;
private final int pin;
private final boolean polarity;
private boolean isPressed;
public boolean isPullDown() {
boolean Ren = ((this.port.getRegister(PortReg.REN) & (1 << this.pin)) != 0);
boolean Up_Down = ((this.port.getRegister(PortReg.OUT) & (1 << this.pin)) != 0);
return !Up_Down & Ren;
}

public void setPressed(boolean isPressed) {
if (this.isPressed != isPressed) {
this.isPressed = isPressed;
boolean isHigh = isPressed ^ (!polarity);
boolean Ren = ((this.port.getRegister(PortReg.REN) & (1 << this.pin)) != 0);
// if potential open, then wait 3 seconds to change
if (isHigh && (btnTyp == Btn_Typ.HighOpen) && !Ren) {
waittimer.restart();
} else {
waittimer.stop();
SetState();
}
}
}

public Button(String id, MSP430Core cpu, IOPort port, int pin, boolean polarity) {
super(id, cpu);
this.port = port;
this.pin = pin;
this.polarity = polarity;
}
public void actionPerformed(ActionEvent e) {
waittimer.stop();
SetState();
}

public boolean isPressed() {
return isPressed;
}
public void SetState() {
boolean isHigh = this.isPressed ^ (!this.polarity);
stateChanged(this.isPressed ? 1 : 0);
if((btnTyp==Btn_Typ.HighOpen)&isPullDown()) isHigh=false;
if (DEBUG)
log(this.isPressed ? "pressed" : "released");
port.setPinState(pin, isHigh ? IOPort.PinState.HI : IOPort.PinState.LOW);
}

public void setPressed(boolean isPressed) {
if (this.isPressed != isPressed) {
this.isPressed = isPressed;
stateChanged(isPressed ? 1 : 0);
if (DEBUG) log(isPressed ? "pressed" : "released");
port.setPinState(pin, isPressed == polarity ? IOPort.PinState.HI : IOPort.PinState.LOW);
}
}
@Override
public int getConfiguration(int parameter) {
return 0;
}

@Override
public int getConfiguration(int parameter) {
return 0;
}
@Override
public int getModeMax() {
return 0;
}

@Override
public int getModeMax() {
return 0;
}
@Override
public String info() {
return " Button is " + (isPressed ? "pressed" : "not pressed");
}

@Override
public String info() {
return " Button is " + (isPressed ? "pressed" : "not pressed");
}
@Override
public void notifyReset() {
SetState();
}
}
Loading