2024-11-11 06:30 AM - edited 2024-11-12 10:00 PM
2024-11-11 11:06 PM
This code is blocking my interrupts.
#define SYSTICK_LOAD (SystemCoreClock/1000000U)
#define SYSTICK_DELAY_CALIB (SYSTICK_LOAD >> 1)
#define DELAY_US(us) \
do { \
uint32_t start = SysTick->VAL; \
uint32_t ticks = (us * SYSTICK_LOAD)-SYSTICK_DELAY_CALIB; \
while((start - SysTick->VAL) < ticks); \
} while (0)
#define DELAY_MS(ms) \
do { \
for (uint32_t i = 0; i < ms; ++i) { \
DELAY_US(1000); \
} \
} while (0)
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
2024-11-12 02:20 AM
So don't do that - don't use blocking delays!
Again, you say this hardware is already being used - so there must already be software to do the basics of scanning the inputs, etc.
Why don't you just use that?
2024-11-12 03:14 AM - edited 2024-11-12 03:24 AM
My friend, of course, I did not write the software on this card, so it does not exist. In other words, someone else wrote it and I do not have that software. I want to revise the software on the card right now. First, I have to run it as it is and then make the revision.
You sound like you're accusing me. I asked for help. There is a table of LEDs but I don't know if I can check it with spi. So I checked it with a scan. I made a working table of LEDs. I can share it if you want.
The PCB connection is like this.. Can it be controlled with SPI?
#define SER_PIN GPIO_PIN_4 // SER_PIN
#define SER_PORT GPIOB
#define SRCLK_PIN GPIO_PIN_12 // SRCLK_PIN
#define SRCLK_PORT GPIOA
#define RCLK_PIN GPIO_PIN_5 // RCLK_PIN
#define RCLK_PORT GPIOB
2024-11-12 03:19 AM
Can you not contact that person?
Does the supplier of that board not provide support?
2024-11-12 03:38 AM - edited 2024-11-12 03:38 AM
Unfortunately, I do not have such an opportunity.
2024-11-12 05:23 AM - edited 2024-11-12 05:23 AM
I told you I was using real hardware. You moved the location to the wrong place.
2024-11-12 05:53 AM
@XooM wrote:There is a table of LEDs
What do you mean by "table" here? Where, exactly, is this "table"?
@XooM wrote:I don't know if I can check it with spi.
What do you mean by "check it" ?
LEDs are (usually) output-only devices, so whatever you write to them is the state they keep; they don't change state spontaneously - so why do you need to "check" them?
@XooM wrote:The PCB connection is like this.. Can it be controlled with SPI?
Well, SPI is just a data line (or two), and a clock line (plus, perhaps, a CS line).
A disadvantage of using the STM32's SPI (like most microcontroller SPI) is that it has fixed data sizes - which may not match your hardware.
So bit-banging may be more suitable.
Have you worked out on paper how to light each LED in your hardware?
Do that first - then you can consider whether the STM32's SPI might be able to achieve that...
2024-11-12 06:07 AM
> My friend, of course, I did not write the software on this card, so it does not exist. In other words, someone else wrote it and I do not have that software.
Assuming a legal background - you could have told us upfront. Which had saved us all from a lot of back and forth.
I suppuse you still have executable, either as ELF file, BIN file, or read-out from the Flash.
Ever heard of Ghidra ? It works quite well for Cortex M, I tried an example myself.
> You sound like you're accusing me. I asked for help.
You could have been much more descriptive about the issues you face, what the project entails, and the involved hardware. I still don't know what MCU variant it was/is based upon.
> The PCB connection is like this.. Can it be controlled with SPI?
That very much depends on the MCU. SPI is serial bus communication standard that happens to match relatively closely with your requirements of data serialisation/deserialisation.
As an example, the F0x1 and F0x2 variants of STM32 do only support SPI data sizes from 4-bit up to 16-bit.
OTOH, these MCUs are clocked below 50MHz, and you would easily get away with "bit-banging", i.e. setting the clock and data lines directly via GPIO pin access.
As a side note, the exact MCU variant and the pins used for serial output would reveal the probably implementation, but such details are not visible in the images you posted. SPI functionality can only be routed to a few specific pins.
2024-11-12 06:12 AM - edited 2024-11-20 11:08 AM
Sanırım sorunumu açıklayamıyorum çünkü acemiyim. Sizinle iletişim kuramıyorum. İlginiz için teşekkür ederim. Giriş veya çıkış bu tabloya göre aktifse ilgili LED'i yakmak için LED'leri kullanıyorum. Baştan beri LED'leri aktifleştirebileceğimi/geçirebileceğimi söyledim ama SPI kullanmadan yönetiyorum. Konudan çok uzaklaştık.. Yardım etmek istiyorsanız, bana LED'leri
nasıl kontrol edeceğimi gösteren SPI kodları verebilirsiniz. Yardım edemezseniz, lütfen cevap vermeyin. Teşekkür ederim
2024-11-12 06:18 AM - edited 2024-11-12 06:19 AM
@Ozone wrote:
As a side note, the exact MCU variant and the pins used for serial output would reveal the probably implementation, but such details are not visible in the images you posted. SPI functionality can only be routed to a few specific pins.
This is what I asked for at least twice but without answer :( ..