M2_SETI/A1/tp-spa/scripts/Setup_CW308_87C51.ipynb
2022-11-18 15:13:15 +01:00

87 lines
2.4 KiB
Text

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import chipwhisperer as cw\n",
"\n",
"try:\n",
" if not scope.connectStatus:\n",
" scope.con()\n",
"except NameError:\n",
" scope = cw.scope()\n",
"\n",
"try:\n",
" if SS_VER == \"SS_VER_2_1\":\n",
" target_type = cw.targets.SimpleSerial2\n",
" elif SS_VER == \"SS_VER_2_0\":\n",
" raise OSError(\"SS_VER_2_0 is deprecated. Use SS_VER_2_1\")\n",
" else:\n",
" target_type = cw.targets.SimpleSerial\n",
"except:\n",
" SS_VER=\"SS_VER_1_1\"\n",
" target_type = cw.targets.SimpleSerial\n",
"\n",
"try:\n",
" target = cw.target(scope, target_type)\n",
"except:\n",
" print(\"INFO: Caught exception on reconnecting to target - attempting to reconnect to scope first.\")\n",
" print(\"INFO: This is a work-around when USB has died without Python knowing. Ignore errors above this line.\")\n",
" scope = cw.scope()\n",
" target = cw.target(scope, target_type)\n",
"\n",
"\n",
"print(\"INFO: Found ChipWhisperer😍\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"scope.default_seutp()\n",
"target.baud = 4800\n",
"#Reset chip - this is NEEDED for device to start.\n",
"#Also you can reset it \n",
"def reset_target(scope):\n",
" scope.io.tio3 = False\n",
" time.sleep(0.05)\n",
" scope.io.tio3 = True\n",
" time.sleep(0.05)\n",
" scope.io.tio3 = False\n",
" \n",
"reset_target(scope)\n",
"\n",
"print(\"**************************************************************\")\n",
"print(\"Use jumpers on H1/H3/H5 to select application. \")\n",
"print(\"Default should work by opening terminal & see testing printed.\")\n",
"print(\"Call reset_8751() to reset target (needed when changing jumpers\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}