Interfacing the GPS module with MSP430 - c

I already interfacing the GPS s-1216 module with 8051. Now I'm going to interfacing the same module with MSP430fr5969 launchpad. I facing the problem in starting itself that to which pin is connection will be doing? can anyone will solve this.. If it possible explain using code functions..

You can use any of this. Either 0 or 1.
PIN 20-TX1, PIN 21-RX1; PIN 24-TX0, PIN 25-RX0.
Select the appropriate function using selection register as each pin has more than 2 functions. In 8051 there is nothing called selection register. But here it is used to define the function of PIN.
Rest of the things are same as in 8051, like UART configuration, baud rate and TX RX functions.
Before trying UART, try blinky IO program to get the basic knowledge on MSP430

Related

Raspberry Pi - UART - disable TX and enable RX in program C

I need connect my raspberry pi 4 model b with a servo via UART, but it is possible only via 1 wire. That means I must connect pin TX and RX together. In order to do so, I must have a way how to manually disable only TX or RX in my C program.
I am able to easily disable RX thanks to termios.h library, but I didn't find any way how to disable TX.
I was trying to disable it through this
tcflow(fd_myUART, TCOOFF); // it should suspend output
But that didn't work, so I thought that maybe if I change the pin of TX to INPUT, it will change the pin from UART to GPIO, but that didn't work either.
Do you have a way, how to do that, please?
First of all, just "randomly" connecting both wires is a bad idea.
Below image shows how to do it better for a prototype.
Slave devices are able to pull the IO line low during a read bit or a reset while the TX signal is high.
When used in this configuration, you should not disable RX nor TX. You can use "normal" UART operation.
More information can be found here (maxim integrated tutorial 214 "USING A UART TO IMPLEMENT A 1-WIRE BUS MASTER")
Since you will have a lot of connected slave, you should consider using a dedicated chip:
I use a DS2482S-100 over I2C.

LCD interfacing with ARM cortex M0+ lpc845

I'm trying to interface 8x2 lcd using parallel interfacing[4 bit mode],
Display used - 8x2 lcd [PC 0802--A]
ST7066U--Dot Matrix LCD Controller/Driver
Since i'm trying to interface using GPIO pins, not using I2C or SPI
interface, and since no drivers are there for this particular MCU[LPC845],
I compared with lpc2148 MCU [lcd.c and lcd.h files], and have made the changes, but not able to write to the display.
And when checked the data/command signals in the oscilloscope, in data pins
I'm getting float voltages[i.e., for d4-D7] LOW signal on this pins, and
high signals on command pins[RS,RW,EN].
Kindly suggest me the process of writing the char/string to the display varies for ARM mcu?as i'm referring lpc2148 libraries.
Thank you

VREF Output on STM32L0

I have an STM32L051 and want to drive an external DAC (SPI).
For that I would like to use the feature, mentioned in the manual, to output the internal reference voltage to the PB1 pin of the STM32.
I use the STM32Cube HAL as a basis. However the examples of using the VREF are limited to internal use for ADCs and comparators.
If I understand correctly, I can use the CFGR3 register to both enable the VREF as well as connect it to the PB1. Using the Cube drivers, I can use the HAL_SYSCFG_VREFINT_OutputSelect(SYSCFG_VREFINT_OUT_PB1) function, but to enable it, I should use either HAL_ADCEx_EnableVREFINT() or HAL_COMPEx_EnableVREFINT(). The manual information on SEL_VREF_OUT indicates that ENBUF_VREFINT_ADC must be set.
Furthermore no mention is made about the configuration of the pin itself. Should I simply declare it as a DAC Pin? An ADC Pin?
Answer
It is as simple as
if ( HALD_ADCEx_EnableVREFINT() != HAL_OK )
{
Error_Handling();
}
HAL_SYSCFG_VREFINT_OutputSelect(SYSCFG_VREFINT_OUT_PB1);
And I can see the 1.22 V on the PB1 output.
It does not require further pin (GPIO) configuration.
Complications and justification for the question (can be skipped)
I had some issues with the board from out electronic dept. and thus switched to the STM32L053-Discovery board. The above solution did not work, and I kept seeing 0V on PB1 (or PB0).
I assumed that was due to some configuration missing. However, after some further tests, I actually found that on that Discovery board, both PB1 and PB0 are reserved for a sensor. By closing the SB23 bridge, I could use PB1 back to the GPIO, and thus see the reference voltage on the pin.

STM32F1 - Using master SPI on bare metal

I've been trying to port some of my AVR code to drive a simple SPI LCD to ARM as a learning exercise (I'm very new to ARM in general). For this I just need to use SPI in master mode.
I looked in the datasheet for my device (STM32F103C8) and found that the SPI1 pins I need, SCK and MOSI are mapped as alternative functions of PA5 and PA7, respectively, along with other peripherals (pg.29). My understanding is that in order to use the SPI function on these pins, I need to make sure that anything else mapped to the same pin is disabled. When looking at the defaults for the peripheral clock control register, however, it looks like the other features are already disabled.
I looked at the SPI section in the reference manual, including section 25.3.3 - Configuring the SPI in master mode. First I enabled the SPI1 master clock in APB2ENR and followed the steps in this section to configure SPI1 to my needs. I also changed the settings for PA5/7 to set their mode to "Alternate Function Output push-pull" (9.1.4). Finally, I enabled SPI1 by setting CR1_SPE.
From my reading, I had thought that by loading a value into the SPI1 data register after configuring SPI as above, the data would be shifted out. However, after writing the data, the TXE flag in the SPI status register never becomes set, indicating that the data I wrote into it is just sat there.
At this point, I'm assuming that there is something else I've failed to configure correctly. For example, I'm not 100% sure about what to do with the PA5/7 pins. I've tried to understand what I can from the datasheets, but I'm not getting anywhere. Is there anything else that needs to be done before it'll work?
I'm almost certain that you did not set SSM and SSI bits in SPIx->CR1 register. SPI in these chips is pretty simple, for the polled transfers you need to set SSM, SSI, SPE, MSTR, correct format (LSBFIRST, CPOL, CPHA) and proper baudrate (BR) in SPIx->CR1 and you're good to go.

How to blink LED after every 1 second using timers in LPC 1768 (C Programming)?

I am new in micro controller programming .I am using embedded C platform for coding. I want to blink LED after every 1 second using timers in LPC 1768. I have option of generating delay using empty "for" loops and crystal frequency for calculation of counter value. But this delay is not precise.
In the given board LPC 1768 is connected to the LEDs through PCA 9532 I2c bus. For controlling LEDs I should use SDA and SCL pins of PCA 9532 .I want to make use of LPC 1768 timers for generating delay of 1 second so that I could blink the LED with 1 second time interval.But problem is that LPC1768 is not directly connected to LED . PCA 9532 is in between them. So can anybody tell me how can I perform it?
It seems like you have to talk to the PCA9532 via I2C.
configure the LPC pins to use I2C
write a simple driver which writes commands over I2C.
configure the PCA9532 via these commands.
PS: If you don't want to write real I2C drivers, you could bit-bang the commands. Be sure to reconfigure the GPIO (SDA) as input to read ACK from chip.
PPS: you find the command structure in the linked datasheet in chapter 7.1 and a sample communication in chapter 8.2.
Hope that's a first help.

Resources