2024-09-20 09:28 AM
Hello to everyone,
Were to start? Let me first try do describe the setup.
1. Using and STM32F446 chip on a custom board. The board has 2-32pins slots: Slot A and B.
2.For communication I'm using the SPI protocol.
3.For slot A using PE12(CKL); PE13(MISO)PE14(MOSI) and for slot B PB13(SCK), PB14(MISO) and PB15(MOSI)
4 Each slot has another 4 ADS connected in Slave Mode.
The interesting part.
First I tried to communicate with the first ADS from the slot A and after a bunch attempts and fails I start checking the schematics I found this Error in schematics
MISO is connected to MOSI! that means that those 4 ADS from Slot A can not be used for moment. I decided to use the Slot B because that one looks connected properly and here I was going nowhere. I was just not getting any response from the ADS , below is the picture from logic annalizer
a quick explanation: according to the documentation the ADS comunicates i 2 byte format. First tels what to do :Read or Write and the second the Address of the register.
So I decided to start with the basic one, READ the ID register (I named it numBytes ,read=0x20 and ID=0x00) spi_ buf is just a buffer were the return info should be placed and here were it comes the best the return response on MISO from ADS is always 0.
Can anyone:
1. Explain why the Slot A has that weird wiring? Only thing that I found in documentation of STM is that in Master-Master mode the MOSI and MISO are bidirectional lines.
2. Why on the Slot B even with right wiring still no response from the ADS?
If any questions you have regardless the setup will try to response.
Thank you .
2024-09-20 10:57 AM - edited 2024-09-20 10:58 AM
Initialize the pins as GPIO outputs and toggle them manually and verify they show up on your logic analyzer. That will ensure you're monitoring what you think you're monitoring.
Ensure pins are correctly initialized. We're only getting a glimpse of the wiring here.
After that, if the chip is powered, it should respond. Issue is probably in the details somewhere.
Who designed the board? That's who you should ask about slot A issues. You can't swap MISO/MOSI on STM32F4. On some other families you can. Could also be wired correctly and just mis-labeled.
2024-09-28 05:02 PM
Hi , for moment I'm not going to use the Slot A, my focus is to make it to communicate to STM, to achieve that I'm going to use just the Slot B for moment . I followed the steps from page 62(Chapter 10) of the ADS1299 Documentation to make the chip to work , and so far I'm at the step nr.5 and getting VCAP1 the voltage of 1.192V so theoretically the chip is initialized.
This is a piece of the code :
//1.Set PC6 (ADC_CLKSEL) low to select the internal clock.
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, GPIO_PIN_RESET); // Select internal clock
//2. POWERING THE ADS ENABLE HIGH pin SLOT2 (PD10=PWDN)
//Set PD10 (ADC_PDWN) to high to power up the ADS.
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_10, GPIO_PIN_SET);
//3 Toggle PC7 (ADS_RESET) to reset the ADS.
// HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_7);// Assert RESET
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, GPIO_PIN_RESET); // Deassert RESET
// Allow some time for power stabilization
HAL_Delay(50); // Delay to allow reset
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, GPIO_PIN_SET); // Deassert RESET
//HAL_Delay(500);
and the "communication" to the chip
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); // Select ADS (CS2 low)
// Transmit read command
//spiStatus=HAL_SPI_GetState(&hspi2);
//HAL_SPI_Transmit(&hspi2, (uint8_t*)&SYS_START, 1, HAL_MAX_DELAY);
HAL_SPI_Transmit(&hspi2,(uint8_t*)&READ, 1, HAL_MAX_DELAY);
HAL_SPI_Transmit(&hspi2,(uint8_t*) &numBytes,1,HAL_MAX_DELAY);
// Receive the ID register content
HAL_SPI_Receive(&hspi2, (uint8_t*)&spi_buf, 1, HAL_MAX_DELAY);
// HAL_SPI_TransmitReceive(&hspi2, (uint8_t *)&READ_ONLY_ID, (uint8_t *)&numBytes, 1, 100);
// Chip Select high
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); // Deselect ADS (CS2 high)
As seen in the code I tried the TransmitReceive () methide too but still no luck. Only thing that comes in my head is that my clock setting are wrong or that way how the bitts are transmited is wrong too.
2024-09-28 06:27 PM
I mean, you can see the signal in the logic analyzer and it looks correct. So it's probably not a code issue. CS, SCK and MOSI all behave as expected. Whatever the reason is for MISO not responding, it's not due to the signal being incorrect. Could be that MISO is not hooked up, or hooked up incorrectly, or chip is not powered correctly, or some other wiring mismatch.