Commit 247657b7 authored by philip's avatar philip
Browse files

eth status led + readme

parent e67618a2
# aggregat controller 02
https://gitlab.zhdk.ch/aggregat-02/a01
https://aggregat.zhdk.ch/
## Todos
- [x] USBMIDI connectivity
- [x] Classical MIDI (over UART) connectivity
- [x] Ethernet-based networking
- [x] DHCP or link-local addressing
- [ ] [mDNS / DNS-SD](https://github.com/tschiemer/minimr) based host/service discovery
- [ ] Control interface TBD
1. Raw UDP (quasi simple)
2. *Proposed* [OSC](https://github.com/MariadeAnton/oscpack) (relatively simple)
3. RTPMIDI (complex, resuable components??)
- [ ] **Control Logic** TBD
- [ ] Configuration using DIP Switch (controller/channel offset) TBD
- [ ] **Motor Control**
- [ ] **Calibration** necessary? how?
- [ ] Hardware: Modules, custom PCB-hat?, case/protection
- Nice to Haves:
## Installation / Flashing
1. Connect the USB cable (programming end / opposite of ethernet plug) to computer.
2. Device should show up as mass storage device (ie external hard disk)
3. Drag & Drop firmware file into external hard disk
-> big LED should flash red-yellow and then stay yellow - *voilà*
## Known Problems & Limitations
- as of 2020-07-02 ethernet interferes with the USB Device interface causing a permanent USB fail, but only if both are connected *at the same time*. It's a problem of the underlying system which might get resolve d in the future.
## Hardware
......@@ -10,25 +39,33 @@ https://aggregat.zhdk.ch/
- Base board: [ST NUCLEO-H743ZI2](https://www.st.com/en/evaluation-tools/nucleo-h743zi.html) (also see [@mbed](https://os.mbed.com/platforms/ST-Nucleo-H743ZI2/))
*note* can possibly be scaled down to a (marginally) cheaper version
- MIDI-Module: [midi-uart-adapter](https://github.com/tschiemer/midi-uart-adapter), to be tested
- MIDI-Module: [midi-uart-adapter](https://github.com/tschiemer/midi-uart-adapter)
## Software
- [Mbed Studio](https://os.mbed.com/studio/) as IDE
Use [Mbed Studio](https://os.mbed.com/studio/) as IDE.
Make sure to install all dependencies:
In Mbed Studio workspace run (on command line):
```bash
git clone git@gitlab.zhdk.ch:aggregat-02/a01.git
cd a01
git submodule update --init --recursive
```
### Problems
- as of 2020-07-02 the official USBMIDI of mbed-os has some (reported) bugs, please update these files:
As of 2020-07-02 the official USBMIDI of mbed-os has some (reported) bugs, please update these files:
- [USBMIDI.h](https://github.com/tschiemer/mbed-os/blob/usbmidi-writeplus-fixes/drivers/USBMIDI.h)
- [USBMIDI.cpp](https://github.com/tschiemer/mbed-os/blob/usbmidi-writeplus-fixes/drivers/source/usb/USBMIDI.cpp)
- [MIDIMessage.h](https://github.com/tschiemer/mbed-os/blob/usbmidi-writeplus-fixes/drivers/internal/MIDIMessage.h)
## Configuration options
### Configuration options
See file `config.h`
## Questions?
- Peter Färber, peter.faerber@zhdk.ch
- Philip Tschiemer, philip.tschiemer@gmail.com
## Copyfright 2020 ICST / ZHdK
......@@ -8,7 +8,7 @@
#define ENABLE_SYSTEM_RESET 1
#define ENABLE_CONTROLLER_LOGIC 0
#define ENABLE_CONTROLLER_LOGIC 1
/************ MOTORS ************/
......@@ -36,7 +36,7 @@
#define USB_POWER_PIN PA_9
#define USB_CONNECTED_LED LED2
#define USB_CONNECTED_LED LED1
// default value
#define USBMIDI_FORWARD_TO_MIDI true
......@@ -63,7 +63,9 @@
/************ NETWORK BASED MIDI ************/
#define USE_NETMIDI 0
#define USE_NETMIDI 1
#define NET_STATUS_LED LED2
// default value
#define NETMIDI_FORWARD_TO_MIDI true
......
......@@ -129,6 +129,8 @@ UDPSocket udp_sock;
bool eth_reconnect = false;
DigitalOut net_led(NET_STATUS_LED);
bool net_to_midi = NETMIDI_FORWARD_TO_MIDI;
bool net_to_usb = NETMIDI_FORWARD_TO_USB;
char net_hostname[64] = "";
......@@ -224,7 +226,6 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
}
printf("\n");
// return;
#if ENABLE_CONTROLLER_LOGIC == 1
MIDIMessage msg;
......@@ -247,7 +248,10 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
// 0xFF = reset
if (msg.data[0] == 0xFF){
system_reset();
printf("system_reset??\n");
}
#else
printf("ENABLE_SYSTEM_RESET == 0\n");
#endif
}
......@@ -450,6 +454,7 @@ void netmidi_init()
udp_sock.set_blocking(false);
// eth_reconnect = true;
net_thread.start(eth_ifup);
}
......@@ -468,13 +473,12 @@ void eth_status_changed(nsapi_event_t evt, intptr_t intptr)
return;
case NSAPI_STATUS_GLOBAL_UP:
printf("eth global up\n");
eth_was_up = true;
printf("eth global up\n");
return;
case NSAPI_STATUS_DISCONNECTED:
printf("eth disconnected!\n");
// eth.disconnect();
return;
case NSAPI_STATUS_CONNECTING:
......@@ -509,7 +513,7 @@ bool eth_connect()
do {
res = eth.connect();
} while( res == NSAPI_ERROR_NO_CONNECTION);
} while( res != NSAPI_ERROR_OK && res != NSAPI_ERROR_DHCP_FAILURE );
// if (res == NSAPI_ERROR_NO_CONNECTION){
// return false;
......@@ -621,6 +625,8 @@ void eth_ifup()
void netmidi_run()
{
net_led = eth.get_connection_status() == NSAPI_STATUS_GLOBAL_UP;
if (eth.get_connection_status() != NSAPI_STATUS_GLOBAL_UP){
return;
}
......
......@@ -8,7 +8,8 @@
"target_overrides": {
"*": {
"target.device_has_add": ["USBDEVICE"],
"target.network-default-interface-type": "ETHERNET"
"target.network-default-interface-type": "ETHERNET",
"lwip.dhcp-timeout": 5
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment