In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Have you already taken a look at the MAX7219 datasheet? It is operated with 5V and needs at least 3.5V to recognize a logical 1 at the logic inputs.
The STM32 runs at 3.3V and is 5V tolerant on many pins, but then you also need to select/program the correct GPIO mode. However, the GPIO initialization is not visible in your code listing, so nobody can know what you have set there.
Devices that work with 5V logic, such as the MAX7219, must be driven with open-drain and pull-up.
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
I know this fact. Yesterday I was going the configuration with my teacher through and he said, that it is fine and that the 5V thing is not "necessary", because it worked also from other students. The proble ist just in the code and I think its the write_byte function.
Consider what parameters HAL_GPIO_WritePin expects and what you provided in write_byte.
Hint: result of the masked value vs. required parameter
But again - it's purely coincidental that it works if you want to drive a 5V CMOS input with 3.3V CMOS levels. This can also be configured with code, so it's also something like "just in the code".
Regards
/Peter
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
No, I gave a tip so that you can at least find one error (if there are several, which I haven't checked yet). The tip is that you have to look at what HAL_GPIO_WritePin wants as a parameter and then compare that with your passed parameters.
Well, the first two parameters are quite clear and - you'll agree - correct, right? (well, hopefully, because nobody here knows what you have connected to which pin).
Then what about the third parameter, which you calculate directly in the call (which is of course allowed) - what does HAL_GPIO_WritePin want to see there and what values does your calculation result in?
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.