I am working on a library for the SAMD21 and ATAES132a. In my program's main loop, I do a scanf to get the users input. One of the options runs a complete test of the ATAES132a and can take about 10 seconds to complete. After that function finishes, it is suppose to return to the main loop, but never does. In debug, the function finishes but never returns. The SAMD21 hangs in the Dummy Handler. Inspecting the stack trace, I see its waiting for usart_serial_getchar. I am a bit stump!
scanf("%c", & menuOneCommand); if (menuOneCommand == '1') { printf("** Scan i2c bus ** \n\r"); // require /r/n to trigger scan_i2c(); } else if (menuOneCommand == '2') { ..do something } else if (menuOneCommand == '9') { ret = aes_get_aes132a_details( & mydetails); if (ret != 0) { printf("aes_get_aes132a_details() failed with code %d ", ret); printst(ret); return 0; } if (mydetails.lock_keys == 0x55 || mydetails.lock_config == 0x55) { printf("Device is not locked. Can not run tests!\n\r"); } else { ret = run_tests(); // finishes but never returns printf("Completed Tests\n\r"); if (ret != 0) { // handle error return 0; } } } else if (menuOneCommand == 'A') { ..do something } else if (menuOneCommand == '\n' || menuOneCommand == '\r') { // ignore }
Here is what AS7 looks like in debug