I have a Blue Pill and I'd like to program it using TinyGo but the Blue Pill had no (obvious) means for hardware programming. So, I bought an STLINK-V3MINI hoping to use JTAG/SWD to program it. I'm uncertain how to connect the two and am seeking guidance before I naively connect the two and zap something.
Here's the STLINK-V3MINI:
Here's the STDC14 connector:
Page 19 of the STLINK's user guide has a pinout for the STDC14 but I can't correlate this to the TinyGo's documentation that suggests needing SWIO, SWCLK,3v and GND.
The ribbon cable is attached to the STDC14 connector and the pinout is described in chapter 9.1.3.
The relevant pins are:
Pin 4: T_SWDIO aka SWDIO aka SWIO
Pin 6: T_SWCLK aka SWCLK
Pins 5 and 7: GND (choose either one)
The STLINK V3 cannot supply power to the Blue Pill (see note at the end of chapter 1). So the easiest solution is to supply power by connecting it to a USB port.
I'm not entirely sure how the ribbon cable is connected. Most likely, the red wire corresponds to pin 1 and the other pins follow in order. On the connector itself (looking at it the same way as on the picture), pin 1 would be bottom right (right side because of red wire, bottom side because it is closer to the notch). Better check it out with the continuity tester of a multi-meterr.
On the Blue Pill, the relevant pins are on the short side:
I made the adapter STDC14 to "Bluepill" according to the wiring below.
Worked fine with both STLink v3 mini and SWD connector of Nucleo-G474RE (connector CN4, but requires to remove IDD jumper for external target).
Related
I am using a MiniBrick8 (from Gilderfluke & Company in Burbank, California), as part of a lighting/ projector rig. The MiniBrick8 needs an input from a button (using a switch) to start a program running (PCMacs). At the moment the MiniBrick8 is also connected to a BrightSign Media Player.
Minibrick8 doesnt connect to computer via RS-232 serial cable when there is a Snap-action-switch (microswitch) attatched and drawing power from the '9-24 VDC' screw output.
The switch has two output parts: NC, NO, and a power input (COM). (NC and NO being normally closed and normally open respectively).
The NC is connected to ground, so when the switch is not pressed down power is routed directly from the VDC through the switch into ground. Then when the button is pressed power is instead routed from the switch into the MiniBrick8's A-input.
I then take the A-inputs return cable and ground it.
Maybe the fact that while the switch is not pressed down current is constantly flowing through the switch into ground? Is this a problem?
Thank you for your help.
SOLVED:
It was perhaps as I thought.
I changed the switch to get a power input into the NO (normally open) connector, leaving the NC (normally closed) connector without any cable attached, connecting the output via the COM connector to one of the A-trigger/input terminals (the other going to ground).
I had previously thought (incorrectly obviously) that all the switch's connectors had to have wires connecting them to something.
Here is a source: YouTube Video: https://youtu.be/pf_Mngbx32w
^^ This helped me figure it out.
I use the MetaTrader Terminal 4, the Strategy Tester, to optimize an Expert Advisor.
After a strategy run, I am looking at the individual trades that were executed in that backtest. I jump from the Results sub-window at the bottom of the screen to the referring candle stick in the main chart.
After jumping to the candle stick chart, the chart shows the referring actions ( sell stop, sell, t/p ) at the left side of the chart.
Question:
How is it possible to have the chart centered around these actions or to have the chart showing these actions at the right side of the time window?
Your operation starts at 15:00 and the graph candle you are pointing is the candle starting at 15:00.
The right of the graph is the future, and the left is the past.
So the graph starts just in time BEFORE the operation happens.
In your graph the left side of the X-Axis is 8 May and the right side of the X-Axis is 12 May.
One issue you could have is that the graph you are showing is H1 (see the left top indication), so you don't have enough time resolution to see the details. If you use a M1 graph you'll see with more accuracy the entry and exit points of your strategy.
Facts first
If your wish is to somehow modify an event-handling of the MetaTrader Terminal 4/5, than( as of 2018-03 ) the software does not provide you any native tool for making this happen. Neither the built-in GUI-event processing ( a-mouse-click ), nor the script-based, code-automated, processing has any means, how a user-code would get an ability to change the default result, as described in your post.
Solution
Yet, there is one possibility to get where you want to. One can build an external process, that can communicate with MetaTrader Terminal and thus build your GUI-presentation(s) absolutely free from any hard-wired MT4 Terminal built-ins.
This way you can integrate analytical platforms, that are limited just by one's imagination and/or budget.
As an example, this is an external real-time GUI from an external analytic processing, based on MT4 data and flow of both XTO/NTO-events, yet working inside a tight RT-control-loop, having a RTT latency of ~ < 75 ms per event-processed:
This heterogeneous, partially-meshed, fully distributed system uses:
MT4 <-> C/C++ -> MATLAB -> python2.7 <-> Tkinter
^ |
| |
+-------------------------------------+
So, you can get any precision, down to the per each QUOTE-event fidelity analytics, if you need and wish to have it.
Got a general question regarding the GPIOs on P9 of the beaglebone black. For instance, I would like to use the UART1 (RX and TX) for a R232 communication and use the I2C2 (SDA and SCL) for a sensor, using a C language application running on Linux. The problem is that the UART1 (RTS and CTS) signals are on those pins, can these features be deactivated (software)? and therefore use the UART1 and I2C2 at the same time?
PIN 19 : UART1_rtsn - I2C2_SCL
PIN 20 : UART1_Ctsn - I2C2_SDA
Next question, the same applies for SPI1 (CS0 and CS1), these pins are also on I2C2 (SDA and SCL).
PIN 19 : I2C2_SCL - spi1_cs1
PIN 20 : I2C2_SDA - spi1_cs0
So the general question : Can all 3 units, UART1-SPI1-I2C2 all run at the same time with no conflict on pins using the P9 header of the bbb?
Thank you very much for your answers
JH
It is technically feasable although when you start foraging into custom pin assignements you have to deal with alot of complexities to get everything up and working. There are many tables around the internet with the references as to which pins can do what. My favorite so far are these two : http://exploringbeaglebone.com/wp-content/uploads/resources/BBBP8Header.pdf, http://exploringbeaglebone.com/wp-content/uploads/resources/BBBP9Header.pdf
If you read these, you can see that each pin can take multiple different functions depending on configuration. These are set to the defaults by the linux kernel at boot time but you can modify the defaults using device tree overlays. The whole process is a little envolved for a single answer here but in short, to do what you want, you would need to modify and recompile the device tree overlay that the kernel loads for the device you want to change the pin assignements off.
Although there are some limits, for example, the beaglebone images are all configured to use I2C2 for identifying capes. So you can theoretically change it's pin assignments but then you shouldn't expect capes to be identified and configured properly when you do. In your example above, the UART1 and I2C2 work without conflict using their default configuration (UART1 only has Rx & TX by default). The SPI1 is a little more work. It's default configuration shares pins with the sound card (HDMI) that must be disabled to get it to work athough it does not conflict with ether UART1 or I2C2 by default.
Notice that each of these pins can have multiple functions but can only by one at any one time. Therefore, if a pin is set to use a given module (say UART1) it will not be affected by another module that can theoretically output on that pin with a different function mode. The kernel will complain if you try to use a pin for 2 functions simultaneously so you can try to load the overlays and see if it conflicts by default. Basically, if the kernel accepts to load the tree overlay, you can generally assume that it does not conflict with any other that is already loaded.
I think the other answer misinterpreted the question, and addresses configuration of the pins to perform a function of the possible mappings available to that pin. Yes, this is easily possible and is largely the point of the design.
With regards to the actual question, the answer is that it's possible but it's going to be very difficult and is most likely not feasible. And only one communication protocol will be able to be used at a time. Additionally, the spi pins are chip select pins, which require either an asserted or de-asserted state, so any kind of i2c clock or data signal will render the chip select non functional.
For i2c/uart, it would require reconfiguration of the pins and software mappings on the fly, and it will only be able to perform one of the possible functions at a time. It will also require software on all sides of the busses to be able to understand what mode the pins are in ie i2c or uart, with mutually separate and smart protocols so that none of the devices on the bus react undesirably to the garbage that will be on the bus when the bus is being used for another operation mode.
The device is a label printer. It can be connected to via bluetooth and USB. I would imagine it is running some kind of linux, as it has a fairly complex interface/screen, but am not sure. In fact, this is something I would like to determine. But my goal is to get a shell, or some kind of 'meaningful' connection through which I can send commands/data which will trigger print events by the printer without using the manufacturer's software
Connecting to the device in ubuntu via USB creates /dev/usb/lp0. I tried connecting to this using python's serial module, but it couldn't connect to the serial port.
Via bluetooth I was also able to connect, using hcitool scan to get the device's MAC address and then rfcomm to connect (using this approach) . This created /dev/rfcomm0, which I was able to connect to and send data to using python.
Is it feasible to mimic the data normally sent over usb/bluetooth by the manufacturer's software to print without the software? I assume getting this would be possible by 'sniffing' data sent over bluetooth while a normal print command is sent by the manufacturer's software (although I suppose there's no reason it would look intelligible to a human).
If this kind of mimicry is possible, I am wondering whether simply sending the equivalent data over bluetooth, for example, would result in a print event. So far I have no reason to believe that data I send via the bluetooth connection is not being received, but I have yet to get any kind of response (data or physical) from the bluetooth connection.
Any advice/suggestions on how I might achieve my overall goal would be appreciated
This is certainly possible (sorry for the answer 6 years later, but hopefully this will help anyone later in need). I have a similar problem and this is how I solved.
I have a MHT-P80F thermo printer. I figured out in settings that it supports a protocol called TSPL. These are the instructions you need to send to a printer and tell it to do either raw text printing, or even bitmaps.
All you need to do is to construct the correct bytestream (in mostly human-readable ASCII) and send it to /dev/usb/lp0. I have not tested it via bluetooth but I assume it should be similar.
For example, if you want to print out a "Hello World", these instructions will suffice:
CLS
SIZE 80mm,50mm
GAP 5mm,0mm
HOME
TEXT 0,0,"0",0,1,1,"Hello World"
PRINT 1
Each line is separated by a "\n".
Explanations (more could be found by searching TSPL):
CLS Tell the printer to clear all previous staged commands.
SIZE Tell the printer the size of each label (width, height).
GAP Between each label there's 5mm space without paper.
HOME (Re-)locate the paper roll for a new print.
PRINT Start printing of 1 copie(s).
Note these instructions are for the use of discrete labels. For a whole paper roll it might be different. TSPL implementations on different printers may differ, so you might to experiment a bit.
Generally, if you can print a bitmap, then you can print virtually any document (e.g. using PIL in Python or Jimp in Node.js to generate an image beforehand). So here's the most useful BITMAP command:
BITMAP 16,24,40,256,0,<BYTE STREAM>
where
16: the starting (left most) X coordinate for your bitmap
24: the starting (top most) Y coordinate for your bitmap
40: the width of bitmap, in BYTES (see below)
256: the height of bitmap, in DOTS
0: mode of print, 0 being overwritting anything in that region
and <BYTESTREAM> being the binary data(black/white) of this image, from left to right and from top to bottom.
The bitmap width is given in bytes, so each byte represents 8 horizontal continous dots in the image. The highest bit 7 being most left, the lowest bit 0 most right. So if as in example we write 40 in this parameter, the image would be 40x8=320 dots in width.
The bitmap height, on the contray, is given in dots.
Most such thermal printer have a DPI of 203. This is an interesting start point to investigate into: 203/25.4 = 7.99, or rounded as 8. So for the printer, each 8 dots equals 1mm. In the above example, X=16 and Y=24 (both in dots) corresponds to starting location X=2mm and Y=3mm.
And finally, you generally do not need to inverse the color of this image. In BITMAP command, a 1 in a bit means correctly white or non-printed dot, and 0 means the black or heated dot.
I am not sure about bluetooth but for USB printing you can use the cups library (licups) and use the APIs to do the priting. It uses IPP protocol. Usually cups uses a .ppd file specific to the printer (which contains the details about the printer) for installing it. For new language versions such as PCL5, 5e, 6 etc there are generic ppd files that can be used to install any printer that uses the respective language
This is a little off the beaten path. I've got a DLink DWL-G520 card I'm using under OpenBSD and it works fine. What I want to do is be able to access the radio part of it. Why? I want to use it in a radio telescope. It's a 2.4 GHz receiver with an external antenna connector. I want to connect some coax, some amplifiers, and an old TV dish and point the dish at the sky. It has an RSSI signal and variable RF gain (which it adjusts, from what I can find) so all I'd need to do is record those over time while pointed at a certain spot in the sky. I don't need to control the frequency really since most natural events are broadband.
I'm poking through the OpenBSD ath driver following nested structs but I don't want any of the normal network stuff, which is most of what the driver does. dmesg identifies it as an AR5212 which according to the Atheros PDF is always paired with an AR2112 radio. Is there any easier way than wading through PCI stuff to see what my options are? I need to turn the transmitter off so it doesn't fry my amps too. Trying to find low level documentation is about impossible from what I've seen. Ultimately I'd like to have this work with other WiFi cards too, but I'll start with this one. I've got a Cistron with an external antenna connector also.
Alan, ab1jx