I am facing problems using sc16is750 breakout board. I want to use the interrupt method mentioned in the datasheet. According to which, the IRQ pin should be active low whenever Rx or Tx pins are active, and an Interrupt should be generated.
But the IRQ pin remains high nonetheless. I have set up an external 1k ohm pull-up resistor as mentioned with 3.3v VDD.
My goal is to use vk16e gps module through spi pins on an arduino uno. I have set up the low interrupt on digital pin 2 and it is working fine. If I manually connect this pin to the ground, the gps data appears successfully. But not with the IRQ pin.
I had a similar issue. Finally I found out that the interrupt pin on the breakout board is not connected to the 2kOhm IRQ pull up.
I added a white wire and now it works fine.
Related
I have a strange problem that I dont understand. Please bare with me as this is a difficult problem to deconstruct. I will thus give as much information as I can with test cases and results I have found.
The problem:
I need to set PA6 LOW and then use the DAC. When the DAC is changed in a transient manner, the pin PA6 will not return to 3V when set to HIGH.
In other words, the DAC causes the upper voltage limit of PA6 to be 0.6-0.8V.
I have confirmed this with oscilloscope.
The following piece of code is called inside a task/thread and executed at 50Hz:
if (enable == 1)
{
HAL_GPIO_WritePin(PROPULSION_ENABLE_GPIO_PORT, PROPULSION_ENABLE_GPIO_PIN, GPIO_PIN_RESET);
HAL_DAC_SetValue(&PropulsionModule_DAC, PropulsionModule_DAC_CHANNEL, DAC_ALIGN_12B_R, PropulsionData.propulsionSetPoint_12bit);
}
else
{
HAL_GPIO_WritePin(PROPULSION_ENABLE_GPIO_PORT, PROPULSION_ENABLE_GPIO_PIN, GPIO_PIN_SET);
HAL_DAC_SetValue(&PropulsionModule_DAC, PropulsionModule_DAC_CHANNEL, DAC_ALIGN_12B_R, 0);
}
Setup and environment
STM32F4 Discovery board
FreeRTOS configured with threads, queues and everything else works as expected
I have a single DAC set up on DAC_channel_2 (PA5) and a GPIO_output (PA6).
I also have these peripherals enabled, CAN bus, UART, several GPIO's, etc. Please see attached picture
Findings:
When I change the PA6 pin to PC4 (the adjacent pin) the problem goes away
When I change DAC_channel_2 to DAC_channel_1 the problem goes away
I flashed the code to two other brand new, out of the box, boards with the same errors.
Once PA6 is faulty and its high state is at 0.6V, resetting the microcontroller will reset the pin PA6 and PA6 will return to 3V in its HIGH state.
Any help would be greatly appreciated.
I found the problem. The problem is the MEMS chip on the discovery board. It is vitally important one realizes that not all pins on the discovery board are usable.
Refer to the first link below from Page 22 on which pins are available. Please note that some of the pins that are "not free" can still be used. See the application notes on each of the chips on the board in the second link.
Link 1: https://www.st.com/resource/en/user_manual/dm00039084-discovery-kit-with-stm32f407vg-mcu-stmicroelectronics.pdf
Link 2: https://ucilnica.fri.uni-lj.si/pluginfile.php/29604/mod_resource/content/1/en.DM00039084.pdf
I am trying to program a Microchip MCP4141 digital potentiometer with the STM32CUBEIDE development environment using a NUCLEO F334R8 board. I am sending a 16 bit command through the SPI communications port. When I send the command byte with the data byte, I cannot notice voltage variations between the P0A and P0W terminals of the MCP4141.
Could you help me find the programming error? Thanks
uint8_t data[2];
data[0]=0x00;
data[1]=0x0F;
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4,GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, data, 2, 500);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4,GPIO_PIN_SET);
Usually when an SPI peripheral does not work, the commands are not received by the slave chip. This can have multiple reasons:
Incorrect wiring (MOSI, MISO, CLK lines)
Incorrect SPI mode (clock phase, clock polarity) --> check SPI settings in CubeMX
Slave chip is in Reset because of incorrect/floating EN or RST Pin
Can you probe the data and clock lines? Do you see a signal being transmitted?
Alternatively, can you successfully read anything from the chips internal memory e.g. the status register?
I am using Waveshare 1.54" ePaper Module. Using SPI peripheral:
CPU freq is 16Mhz
SPI Prescaler DIV by 8
MSB FIRST
CPOL=0, CPHA=1
The Display does not response but it respond with TI CC1310 properly.
The problem with SPI is after transmitting byte it does not go to ideal high state.
I have checked with logic analyser.
The SPI is initialised thus:
/****************** Initializing The SPI Peripheral ******************/
void SPI_setup(void)
{
CLK_PeripheralClockConfig(CLK_PERIPHERAL_SPI, ENABLE); //Enable SPI Peripheral Clock
//Set the MOSI, MISO and SCk at high Level.
//GPIO_ExternalPullUpConfig(GPIOC, (GPIO_Pin_TypeDef)(GPIO_PIN_6),ENABLE);
SPI_DeInit();
SPI_Init(SPI_FIRSTBIT_MSB, //Send MSB First
SPI_BAUDRATEPRESCALER_8, //Fosc/16 = 1MHz
SPI_MODE_MASTER,
SPI_CLOCKPOLARITY_LOW, //IDEAL Clock Polarity is LOW
SPI_CLOCKPHASE_2EDGE, //The first clock transition is the first data capture edge
SPI_DATADIRECTION_2LINES_FULLDUPLEX, //Only TX is Enable
SPI_NSS_SOFT,
0x00);
SPI_Cmd(ENABLE);
}
This is pretty much the same problem you had at Issue in interfacing SPI e-ink display with PIC 18F46K22 only on a different processor. Worth noting that CPHA on STM8 has the opposite sense to CPE on PIC18 which may be the cause of your error. That is to say that CPHA=1 on the STM8 has the same effect as CKE=0 on the PIC18. You really have to look at the timing diagrams for each part carefully.
From https://www.waveshare.com/wiki/1.54inch_e-Paper_Module:
Compare with the STM8 reference manual:
Clearly you need one of:
CPHA=1 / CPOL=1 (SPI_CLOCKPOLARITY_HIGH / SPI_CLOCKPHASE_2EDGE) or
CPHA=0 / CPOL=0 (SPI_CLOCKPOLARITY_LOW / SPI_CLOCKPHASE_1EDGE)
If it is the SCLK that you want to be normally-high, then you need the first option - although I fail to see why that is "ideal", the Waveshare diagram clearly indicates that either is acceptable.
I need to create a virtual uart port on a stm32 microcontroller. The pins are given and can be changed to timer input channels. The recieving signal is going to be modulated in current and voltage and i need to detect both. Those two pins can not be assigned to a uart. Does somebody has a tutorial or something, that can lead me in the right direction? I just started programming microcontrollers and i am still strugeling with all the timer, interrupts and details stuff.
If we are talking aobut baudrates for small (9600), then you can achieve this with timer and EXTI.
On EXTI set pin to rising and falling edge and between each IRQs check timer value.
If value is greater than start and stop condition time, you failed, else you have to check time spent for EXTi and calculate whether you received 10101010 or 11001100 or any other combination.
For TX mode, use timer for precise interrupts at bit slice for UART output data and create state machine for data output bit by bit.
Another option is to use SPI as virtual UART.
I would like to implement a pulse-sensitive, aka edge-triggered, interrupt on an LPC1759 microcontroller. In the UM10360.pdf datasheet and ARM Cortex-M3 user guide, it says that interrupts can be triggered based on level- or pulse-sensitive behavior, but I am unable to find how to set this to be pulse-sensitive. Can someone please tell me where to set this?
For my particular application(interfacing the LPC1759 with an AD7794 ADC), I would like to trigger an interrupt based on the falling edge of the MISO pin. Although it is not explicitly stated that the interrupt is trigger on the MISO value, I am assuming this based on the fact that, of the four SPI signals, the MISO is the only input to the microcontroller. Please let me know if this is not correct.
See UM10360.pdf, chapter 9.5.6: "GPIO interrupt registers". You can enable rising and falling edge interrupts only on port 0 and 2 pins. The interrupt vector is the same as external interrupt 3.