-
Help getting STM32 to work
11/03/2017 at 21:46 • 4 commentsHello everyone! I have a question regarding my game console (https://hackaday.io/project/9907-kyle-an-8-bit-portable-game-console). I'm trying to program the STM32 chip in it (specifically the STM32F401), but I'm getting trouble having the bootloader to do anything. I tried USB mode but my computer gives a Device Descriptor Request Failed error, but I think that's because I accidentally left out termination resistors. So I tried SPI mode using my Arduino, but all I can get it to do is send a bunch of 0xFF and then 0x00. It never sends the ACK byte it should be sending. I made sure the wiring was correct and there is no other method I can use to program this chip. The closest I got was getting the chip to send 0xFF on SPI when I reset it. I know it's going into the bootloader because when I have the program jumper removed, my PC doesnt see it all on the USB port. But when I put the jumper in and reset it, the PC gives the error. So the STM32 is trying to communicate with my PC but something is going wrong. I'll put up my schematics and arduino code below.
(Schematic) https://cdn.hackaday.io/files/9907423861088/board.pdf
#include <SPI.h> const byte CS_Pin = 53; const byte Get_Version = 0x01; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(CS_Pin, OUTPUT); digitalWrite(CS_Pin, LOW); SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0)); } void loop() { // put your main code here, to run repeatedly: Serial.println(SPIWrite(0x5A)); Serial.println(SPIWrite(0x01)); Serial.println(SPIWrite(0xFE)); while(true){ Serial.println(SPIWrite(0x5A)); Serial.println(SPIWrite(0x01)); Serial.println(SPIWrite(0xFE)); } } byte SPIRead(){ byte res = SPI.transfer(0x00); return res; } byte SPIWrite(byte dat){ byte res = SPI.transfer(dat); return res; }