Skip to content

Instantly share code, notes, and snippets.

@arenaudineau
Last active July 20, 2022 11:17
Show Gist options
  • Save arenaudineau/42e6704368cb00af8836932d38dd419e to your computer and use it in GitHub Desktop.
Save arenaudineau/42e6704368cb00af8836932d38dd419e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import d3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Init the driver without B1530 and Keith2230G (DC Power Supply)\n",
"driver = d3.Design3Driver(k2230g_addr=None, b1530_addr=None)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CMD.WRITE_CS\n",
"CMD.SET_ADR\n",
"CMD.SET\n",
"CMD.RESET\n",
"CMD.SENSE\n",
"CMD.SENSE_UC\n",
"CMD.CLK\n",
"CMD.CLK2\n",
"CMD.ACK_MODE\n",
"CMD.DEBUG_ECHO\n",
"CMD.DEBUG_LED\n",
"------------\n",
"CS.CBL\n",
"CS.CBLEN\n",
"CS.CWL\n",
"CS.CSL\n",
"CS.READ\n",
"CS.BIT_IN\n",
"CS.CLK\n",
"CS.CLK2\n"
]
}
],
"source": [
"for cmd in d3.mcd.CMD_LIST:\n",
" print(cmd)\n",
"print(\"------------\")\n",
"for cs in d3.mcd.CS_LIST:\n",
" print(cs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"driver._mcd.debug_led() # Blinks LED then returns 'Hello, C2N!'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Configure dis/precharge_time pour sensing\n",
"driver.discharge_time = 5e-6\n",
"driver.precharge_time = 5e-6"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"driver.fill(\n",
" [\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0],\n",
" [1, 0, -1, 0, 1, 0, -1, 0]\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"driver.sense()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Direct access to µc commands:\n",
"driver._mcd.write_cs(d3.mcd.CS.CBLEN, d3.State.SET)\n",
"driver._mcd.write_cs(d3.mcd.CS.READ, d3.State.RESET)\n",
"\n",
"driver._mcd.clk()\n",
"driver._mcd.sense_uc()\n",
"\n",
"driver._mcd.set(*[0b01]*64)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
},
"vscode": {
"interpreter": {
"hash": "891ccb99f08d64f4762b6826d17404fb4dd9ba6c6f91a8066d6b54a291fd3150"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment